@font-face {
  font-family: "MiSans";
  src: url("fonts/MiSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "MiSans";
  src: url("fonts/MiSans-Medium.woff2") format("woff2");
  font-weight: 450 600;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --canvas: #eeeeec;
  --paper: #ffffff;
  --soft: #f5f5f3;
  --ink: #262625;
  --secondary: #626260;
  --line: #dededb;
  --accent: #955d36;
  --accent-soft: #f5f0eb;
  --ease: cubic-bezier(.22,.72,.2,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100dvh; min-height: 0; overflow: hidden; }
body { color: var(--ink); background: var(--canvas); font: 14px/1.6 "MiSans","Segoe UI",sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
input { border: 0; background: none; outline: none; min-width: 0; }
input::placeholder { color: #767674; }
select { max-width: 240px; padding: 5px 23px 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); font-size: 12px; line-height: 1.6; outline: none; }
option { color: var(--ink); background: var(--paper); }
[hidden] { display: none !important; }
.pager, .intro, footer, .diamond-flow, .auction-history, input[type=file] { display: none !important; }

/* The frame stays fixed. Each working list owns its scroll. */
.topbar { height: 60px; min-height: 60px; display: flex; align-items: center; gap: 24px; padding: 0 20px; background: #fafaf9; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 25px; font-weight: 550; letter-spacing: -.8px; white-space: nowrap; }
.brand-sub { margin-left: 12px; color: var(--secondary); font-size: 11px; font-weight: 400; letter-spacing: .6px; }
.brandmark { display: grid; grid-template-columns: 7px 7px; grid-template-rows: 7px 7px; gap: 3px; transform: rotate(-9deg); }
.brandmark i { background: #333332; border-radius: 1px; }
.brandmark i:nth-child(2) { background: #b58b6c; }
.brandmark i:last-child { background: #bfbfba; }
.topbar nav { display: flex; gap: 4px; padding: 3px; border-radius: 8px; background: #eaeae7; }
.nav-button { padding: 7px 17px; border-radius: 5px; color: var(--secondary); font-size: 13px; line-height: 1.5; }
.nav-button.active { color: #fff; background: #282828; box-shadow: 0 1px 4px #00000012; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.local-badge { display: flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 11px; }
.local-badge i { width: 4px; height: 4px; border-radius: 50%; background: #ac7854; }
.quiet { padding: 5px; color: var(--secondary); font-size: 12px; }
.quiet:hover, .text-button:hover { color: var(--accent); }
.new-match { padding: 6px 12px; border: 1px solid #d5d5d1; border-radius: 6px; background: var(--paper); color: #454543; font-size: 12px; }
main { display: flex; flex-direction: column; gap: 10px; height: calc(100dvh - 60px); min-height: 0; padding: 12px 16px; }
.filterbar { display: flex; align-items: center; gap: 16px; height: 40px; min-height: 40px; flex-shrink: 0; padding: 5px 12px; border: 1px solid var(--line); border-radius: 7px; background: #f8f8f6; }
.filter-field { display: flex; align-items: center; gap: 8px; }
.filter-field > span { color: var(--secondary); font-size: 11px; white-space: nowrap; }
.filter-field select { padding: 4px 24px 4px 9px; border: 0; background: #eaeae7; font-size: 12px; }
.filter-note { margin-left: auto; color: var(--secondary); font-size: 11px; }
.text-button { padding: 4px 0; color: var(--secondary); font-size: 11px; white-space: nowrap; }
.filterbar > .refresh { margin-left: auto; font-size: 11px; }
.topbar .filterbar { flex: 1; justify-content: flex-end; min-height: 0; height: auto; gap: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.topbar .filterbar > .refresh { margin-left: 4px; }
.topbar .filter-field { gap: 6px; }
.job-banner { flex-shrink: 0; padding: 5px 11px; border: 1px solid #d9bda5; border-radius: 6px; background: var(--accent-soft); color: #815839; font-size: 12px; }
.selectionbar { display: flex; align-items: center; gap: 12px; height: 38px; min-height: 38px; flex-shrink: 0; padding: 5px 12px; border: 1px solid var(--line); border-radius: 7px; background: #f8f8f6; }
.ranked-selection { display: flex; align-items: center; gap: 13px; min-width: 0; flex: 1; }
.context-line { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--secondary); font-size: 12px; }
.context-line > span:first-child, .context-line > span:nth-of-type(2) { display: none; }
.context-line strong { color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; }
.context-line select { max-width: 252px; padding: 3px 22px 3px 9px; background: #eeede9; font-size: 12px; }
.context-line .tag { padding: 2px 6px; background: #eeede9; color: var(--secondary); font-size: 10px; font-weight: 400; }
.diamond-selection { min-width: 0; flex: 1; overflow: hidden; color: #464644; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
body[data-mode="ranked"] .diamond-selection, body[data-mode="diamond"] .ranked-selection { display: none; }
#compactSlotSummary { color: var(--secondary); font-size: 11px; white-space: nowrap; }
#chooseLord { font-size: 11px; white-space: nowrap; }
.formation-strip { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding-left: 13px; border-left: 1px solid var(--line); }
.formation-label { flex-shrink: 0; color: var(--secondary); font-size: 11px; }
.formation-heroes { display: flex; align-items: center; gap: 13px; min-width: 0; overflow-x: auto; padding: 2px 0; scrollbar-width: thin; }
.formation-hero { flex-shrink: 0; color: #626260; font-size: 13px; white-space: nowrap; }
.formation-hero.core-hero { color: #353534; font-weight: 500; }
.formation-empty { color: var(--secondary); font-size: 11px; white-space: nowrap; }
.workspace-tabs { display: none; gap: 4px; flex-shrink: 0; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #e9e9e6; }
.workspace-tabs button { flex: 1; padding: 6px 9px; border-radius: 4px; color: var(--secondary); font-size: 12px; }
.workspace-tabs button.active { color: var(--ink); background: var(--paper); box-shadow: 0 1px 4px #0000000a; }
.compare-tab { display: none; }
.pack-session-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 0 14px 8px; }
.pack-session-controls > span { flex: 1; color: var(--secondary); font-size: 11px; white-space: nowrap; }
.pack-session-controls select { max-width: 142px; padding: 3px 18px 3px 7px; font-size: 11px; }
.pack-session-controls .text-button { font-size: 10px; }
.pack-advice { flex-shrink: 0; margin: 0 12px 8px; padding: 8px 11px; border: 1px solid #d8cbbb; border-radius: 7px; background: #f5f0eb; }
.pack-advice > strong { display: block; overflow: hidden; color: #775236; font-size: 12px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.pack-advice > p { margin: 4px 0 0; color: var(--secondary); font-size: 10px; }
.pack-advice .draw-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 5px; }
.draw-stats span { display: block; color: var(--secondary); font-size: 10px; white-space: nowrap; }
.draw-stats b { color: #44443e; font: 400 17px/1.3 "Segoe UI",sans-serif; }
.pack-decision-actions { display: flex; gap: 7px; flex-shrink: 0; padding: 9px 12px 0; }
.pack-decision-actions button { flex: 1; padding: 7px 8px; font-size: 11px; white-space: nowrap; }
.secondary { border: 1px solid var(--line); border-radius: 5px; background: #f5f5f2; color: #595955; }
.secondary:hover { background: #eeede8; }
.pack-model-caption { margin: 6px 12px 9px; color: var(--secondary); font-size: 10px; }
.pack-rule-field { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; font-size: 13px; }
.pack-rule-field select { min-width: 0; font-size: 12px; }
#packModelDialog { width: min(620px,calc(100vw - 28px)); }
#packModelDetails, #packOfferHistory { color: #5a5a56; font-size: 13px; line-height: 1.8; }
#packModelDetails code { display: block; padding: 9px 12px; border-radius: 6px; background: #f0efeb; font-size: 12px; }
#packOfferHistory p { margin: 10px 0; }
#undoPackRefresh { padding: 7px 12px; margin-top: 8px; font-size: 12px; }
#dashboardWorkspace { display: grid; grid-template-columns: minmax(0,2fr) minmax(330px,1fr); gap: 16px; min-height: 0; min-width: 0; flex: 1; }
.mode-workspace { display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; }
.workspace-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; height: 100%; min-height: 0; min-width: 0; }
.panel { min-height: 0; min-width: 0; overflow: hidden; border: 1px solid #dededa; border-radius: 10px; background: var(--paper); box-shadow: 0 2px 3px #00000002,0 8px 24px #00000002; }
.candidates-panel, .comparison-panel { display: flex; flex-direction: column; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; flex-shrink: 0; padding: 14px 17px 12px; }
.panel-heading h2 { margin: 0; color: var(--ink); font-size: 18px; line-height: 1.5; font-weight: 450; letter-spacing: -.35px; }
.panel-heading select { max-width: 133px; padding: 5px 23px 5px 8px; font-size: 12px; }
.eyebrow, .quality-dot { display: none; }
.muted { color: var(--secondary); font-size: 11px; font-weight: 400; }
.count { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: #efefec; color: var(--secondary); font: 400 11px/1.7 "Segoe UI",sans-serif; vertical-align: middle; }
h3 { margin: 0; font-size: 14px; font-weight: 500; }

/* Candidate selection and comparison share one typographic hierarchy. */
.search-row { display: flex; gap: 8px; padding: 0 16px 12px; flex-shrink: 0; }
.searchbox { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.searchbox > span { color: #747471; font: 18px/1 "Segoe UI",sans-serif; }
.searchbox input { width: 100%; color: var(--ink); font-size: 13px; line-height: 1.7; }
.searchbox:focus-within { border-color: #9f8b7d; background: #fff; box-shadow: 0 0 0 3px #9f8b7d10; }
.search-row select { max-width: 92px; padding: 4px 20px 4px 7px; font-size: 11px; }
.searchbox.full { margin: 0 16px 12px; flex: 0; }
.list-caption { display: grid; grid-template-columns: minmax(0,1fr) 57px 57px; gap: 10px; padding: 8px 16px; flex-shrink: 0; border-top: 1px solid #e7e7e4; border-bottom: 1px solid #e7e7e4; background: #f6f6f4; color: var(--secondary); font-size: 11px; }
.list-caption span:not(:first-child) { text-align: right; }
.list-caption span:last-child { display: none; }
.candidate-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.candidate-row { display: grid; grid-template-columns: minmax(0,1fr) 57px 57px; align-items: center; gap: 10px; width: 100%; height: 67px; padding: 11px 16px; border-bottom: 1px solid #ecece9; text-align: left; }
.candidate-row:hover { background: #f6f6f3; }
.candidate-row.chosen { background: #f0efeb; box-shadow: inset 2px 0 #8b705b; }
.candidate-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.candidate-info { min-width: 0; }
.candidate-info strong { display: block; overflow: hidden; color: #30302e; font-size: 15px; font-weight: 400; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.candidate-info small { display: block; overflow: hidden; margin-top: 3px; color: var(--secondary); font-size: 12px; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.select-dot { display: grid; place-items: center; width: 17px; min-width: 17px; height: 17px; border: 1px solid #cecec8; border-radius: 4px; background: #fff; color: #777772; font: 12px/1 "Segoe UI",sans-serif; }
.chosen .select-dot { border-color: #555550; background: #555550; color: #fff; }
.candidate-row .stat { color: #64645f; font: 400 15px/1.5 "Segoe UI",sans-serif; text-align: right; font-variant-numeric: tabular-nums; }
.candidate-row .stat.em { color: #373733; font-weight: 500; }
.candidate-row > .stat:last-child { display: none; }
.comparison-list { flex: 1; min-height: 0; padding: 0 13px 6px; overflow-y: auto; overflow-x: hidden; }
.compare-card { position: relative; height: var(--card-height,160px); min-height: var(--card-height,160px); max-height: var(--card-height,160px); margin-bottom: 8px; padding: 12px 14px; overflow: hidden; border: 1px solid #dfdfdb; border-radius: 8px; background: #f7f7f5; cursor: pointer; }
.compare-card:last-child { margin-bottom: 0; }
.compare-card.best { border-color: #b5967e; background: #f5f0eb; }
.compare-card.focused { box-shadow: inset 0 0 0 1px #b5967e; }
.compare-card:hover { border-color: #ad9d90; }
.compare-top { display: flex; align-items: center; gap: 8px; min-height: 24px; padding-right: 45px; line-height: 1.5; }
.compare-top strong { min-width: 0; flex: 1; overflow: hidden; color: #32322f; font-size: 16px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.compare-rank { color: #76766f; font: 400 11px "Segoe UI",sans-serif; }
.best .compare-rank { color: var(--accent); }
.tag { padding: 2px 6px; border-radius: 3px; background: #eae0d6; color: #865533; font-size: 10px; font-weight: 500; white-space: nowrap; }
.option-info, .remove-item { position: absolute; top: 10px; width: 22px; height: 23px; padding: 0; border-radius: 4px; color: #797973; font: 15px/1 "Segoe UI",sans-serif; }
.option-info { right: 28px; }
.remove-item { right: 5px; font-size: 18px; }
.option-info:hover, .remove-item:hover { background: #e9e5df; color: var(--accent); }
.compare-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 6px; }
.compare-stats small { display: block; color: var(--secondary); font-size: 11px; line-height: 1.5; }
.compare-stats b { color: #44443e; font: 400 23px/1.35 "Segoe UI",sans-serif; font-variant-numeric: tabular-nums; }
.best .compare-stats b.main { color: #925b33; font-weight: 500; }
.compare-desc { margin-top: 6px; color: var(--secondary); font-size: 12px; line-height: 1.5; }
.effect-copy { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta-copy { overflow: hidden; margin-top: 4px; color: #6e6e66; font-size: 11px; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.comparison-list[data-density="regular"] .compare-card { padding: 10px 14px; }
.comparison-list[data-density="compact"] .compare-card { padding: 8px 13px; }
.comparison-list[data-density="compact"] .effect-copy { -webkit-line-clamp: 1; margin-top: 4px; }
.comparison-list[data-density="compact"] .compare-stats { margin-top: 4px; }
.comparison-list[data-density="compact"] .compare-stats b { font-size: 22px; line-height: 1.25; }
.comparison-list[data-density="tight"] .compare-card { padding: 6px 12px; }
.comparison-list[data-density="tight"] .compare-top { min-height: 22px; }
.comparison-list[data-density="tight"] .effect-copy { display: none; }
.comparison-list[data-density="tight"] .compare-top strong { font-size: 15px; }
.comparison-list[data-density="tight"] .compare-stats { margin-top: 2px; }
.comparison-list[data-density="tight"] .compare-stats small { font-size: 10px; }
.comparison-list[data-density="tight"] .compare-stats b { font-size: 21px; line-height: 1.15; }
.comparison-list[data-density="tight"] .meta-copy { margin-top: 3px; font-size: 10px; line-height: 1.4; }
.board-tip { flex-shrink: 0; margin: 0; padding: 10px 15px; color: var(--secondary); font-size: 11px; line-height: 1.6; }
.empty { padding: 30px 18px; color: var(--secondary); text-align: center; font-size: 12px; line-height: 1.8; }
.empty strong { display: block; margin-bottom: 8px; color: #55554f; font-size: 14px; font-weight: 400; }
.empty-symbol { margin-bottom: 8px; color: #b7b0a8; font: 25px/1.5 "Segoe UI",sans-serif; }
.best-summary { display: none; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; padding: 12px 15px; border-top: 1px solid #dcd7d0; background: #f5f1ec; color: var(--secondary); text-align: left; font-size: 10px; }
.best-summary strong { min-width: 0; flex: 1; overflow: hidden; color: var(--accent); font-size: 12px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.best-summary span { white-space: nowrap; }
.primary { padding: 8px 12px; border: 1px solid #2b2b29; border-radius: 5px; background: #2b2b29; color: #fff; font-size: 12px; font-weight: 400; line-height: 1.5; box-shadow: 0 2px 4px #00000006; }
.primary:hover:not(:disabled) { border-color: #514339; background: #514339; box-shadow: 0 4px 9px #0000000b; }
.primary.wide { width: calc(100% - 26px); flex-shrink: 0; margin: 5px 13px 0; padding: 9px 11px; }
.inline-actions { display: flex; justify-content: space-between; gap: 8px; flex-shrink: 0; margin: 5px 15px 0; }

/* One equipment panel, with three small workspaces rather than nested cards. */
.equipment-section { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; padding: 12px; border: 1px solid #dededa; border-radius: 10px; background: #fafaf8; box-shadow: 0 8px 24px #00000002; }
.gear-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 29px; flex-shrink: 0; }
.gear-heading h2 { margin: 0; color: var(--ink); font-size: 18px; font-weight: 450; letter-spacing: -.35px; }
.gear-heading small { margin-left: 5px; color: var(--secondary); font-size: 11px; font-weight: 400; }
.saved-indicator { max-width: 167px; overflow: hidden; color: var(--secondary); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.target-plan-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; flex-shrink: 0; padding: 3px 1px 7px; border-bottom: 1px solid #dfdfd9; }
.target-plan-header > div { min-width: 0; }
.target-plan-header strong { display: block; overflow: hidden; color: #484843; font-size: 13px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.target-plan-header .text-button { font-size: 11px; }
.gear-tabs { display: flex; gap: 4px; flex-shrink: 0; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #ecece8; }
.gear-tabs button { flex: 1; padding: 4px 5px; border-radius: 3px; color: var(--secondary); font-size: 11px; white-space: nowrap; }
.gear-tabs button.active { background: #fff; color: #333330; box-shadow: 0 1px 3px #00000009; }
.equipment-grid { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.equipment-grid > .panel { display: flex; flex-direction: column; min-height: 0; flex: 1; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.equipment-grid .panel-heading { min-height: 35px; padding: 6px 0 8px; }
.equipment-grid h3 { color: #464640; font-size: 13px; font-weight: 400; }
.equipment-grid .muted { font-size: 11px; }
.base-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; flex-shrink: 0; padding-bottom: 12px; }
.base-card { position: relative; padding: 6px 4px; border: 1px solid #dcdcd6; border-radius: 5px; background: #f4f4f1; color: #53534d; font-size: 11px; line-height: 1.5; white-space: nowrap; }
.base-order { position: absolute; top: 1px; left: 4px; color: #9c7658; font: 8px "Segoe UI",sans-serif; }
.base-glyph { display: none; }
.base-card:hover { border-color: #b5a69a; background: #eeece7; }
.base-card.active { border-color: #ad8b71; background: #eee6de; color: #815533; }
.craft-suggestions { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; border-top: 1px solid #dfdfd8; }
.craft-option { display: flex; align-items: center; gap: 8px; min-height: 78px; padding: 13px 0; border-bottom: 1px solid #e6e6df; }
.craft-copy { min-width: 0; flex: 1; }
.craft-copy strong { display: block; overflow: hidden; color: #353530; font-size: 14px; font-weight: 400; line-height: 1.6; white-space: nowrap; text-overflow: ellipsis; }
.craft-copy b { color: #7d5233; font-weight: 500; }
.craft-copy small { display: block; max-width: 330px; overflow: hidden; margin-top: 4px; color: var(--secondary); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.craft-rank, .priority-no { color: #77776e; font: 11px "Segoe UI",sans-serif; }
.craft-option:first-child .craft-rank { color: var(--accent); }
.score { color: #7c593d; font: 400 16px "Segoe UI",sans-serif; font-variant-numeric: tabular-nums; }
.craft-option .primary { padding: 7px 8px; font-size: 11px; white-space: nowrap; }
.priority-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.priority-row { display: flex; align-items: center; gap: 10px; min-height: 84px; padding: 12px 0; border-bottom: 1px solid #e3e3dc; cursor: pointer; }
.priority-copy { flex: 1; min-width: 0; }
.priority-title { color: #33332f; font-size: 14px; font-weight: 400; }
.priority-path { margin-top: 3px; color: #57574f; font-size: 13px; }
.priority-path b { color: #7d5233; font-weight: 500; }
.priority-copy small { display: block; overflow: hidden; margin-top: 4px; color: var(--secondary); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.priority-row:first-child .priority-title { color: #86562f; }
.priority-row:hover { background: #f3f1eb; }
.next-base-hint { padding: 10px 11px; border: 1px solid #d5c3b5; border-radius: 6px; background: #f1ebe5; color: #795637; font-size: 12px; line-height: 1.6; cursor: pointer; flex-shrink: 0; }
.next-base-hint:hover { border-color: #b99a82; }
#loadoutPanel { flex-shrink: 0; }
.loadout-heading { display: flex; align-items: center; gap: 8px; min-height: 30px; color: #55554e; font-size: 12px; }
.loadout-heading select { max-width: none; min-width: 0; flex: 1; padding: 5px 23px 5px 9px; font-size: 12px; }
.loadout-heading > span { color: #7f5938; font: 400 18px "Segoe UI",sans-serif; }
.hero-loadout { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 9px; }
.loadout-slot { min-width: 0; min-height: 131px; padding: 11px 8px; border: 1px solid #ddddd5; border-radius: 6px; background: #f2f2ee; }
.loadout-slot small { color: var(--secondary); font-size: 11px; line-height: 1.6; }
.loadout-slot strong { display: block; overflow: hidden; margin: 8px 0; color: #393933; font-size: 14px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.loadout-slot .primary { width: 100%; margin-top: 8px; padding: 6px 3px; font-size: 10px; }
.loadout-slot.owned { border-color: #bda189; background: #f1e9e0; }
.ledger { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; border: 1px solid #ddddd5; border-radius: 7px; background: #f5f5f1; }
.ledger-heading { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 43px; padding: 10px 11px; flex-shrink: 0; }
.ledger-heading h3 { color: #46463e; font-size: 12px; font-weight: 400; white-space: normal; }
.ledger-heading > div { display: flex; gap: 8px; }
.ledger-heading .text-button { font-size: 10px; }
#ledgerCount { margin-left: 4px; font-size: 9px; }
#equipmentLedger { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.ledger-item { display: flex; align-items: center; gap: 7px; min-height: 58px; padding: 10px; border-top: 1px solid #e0e0d7; }
.ledger-copy { min-width: 0; flex: 1; }
.ledger-copy strong { display: block; overflow: hidden; color: #494941; font-size: 13px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.ledger-item select { max-width: 108px; padding: 4px 18px 4px 5px; font-size: 11px; }
.ledger-item .text-button { font-size: 10px; }
.ledger-glyph { display: grid; place-items: center; width: 18px; min-width: 18px; height: 18px; border: 1px solid #c8b4a3; border-radius: 3px; background: #ebe4dc; color: #806045; font-size: 10px; }
.ledger-empty { margin: 0; padding: 10px 11px; color: var(--secondary); font-size: 12px; line-height: 1.8; }

/* Auction controls remain visible while its candidates scroll. */
#auctionWorkspace { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#auctionWorkspace > .workspace-grid { flex: 1; height: auto; }
.auction-summary { display: flex; align-items: center; gap: 10px; min-height: 36px; flex-shrink: 0; margin-bottom: 10px; padding: 5px 11px; border: 1px solid #d9d9d1; border-radius: 6px; background: #f7f7f3; }
.auction-summary .small-label { display: none; }
.auction-summary strong { color: #45453e; font-size: 12px; font-weight: 400; }
.round-stepper { display: flex; gap: 4px; min-width: 0; overflow-x: auto; margin-left: auto; }
.round-dot { display: grid; place-items: center; width: 21px; min-width: 21px; height: 21px; border: 1px solid #d2d2ca; border-radius: 50%; background: #f5f5f0; color: #69695e; font: 10px "Segoe UI",sans-serif; }
.round-dot.current { border-color: #46443c; background: #46443c; color: #fff; }
.round-dot.done { border-color: #b8a28e; color: #865d38; }

/* Detail dialogs use the same neutral surfaces and readable body type. */
dialog { width: min(650px,94vw); max-height: 86dvh; overflow-y: auto; margin: auto; padding: 24px; border: 1px solid #d9d8d2; border-radius: 13px; background: #fdfdfb; color: #44443c; box-shadow: 0 25px 85px #29251f29; }
dialog::backdrop { background: #26242055; backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 17px; }
.dialog-heading h2 { margin: 0; color: #30302a; font-size: 21px; font-weight: 500; line-height: 1.5; }
.dialog-heading .quiet { color: #707067; font: 22px "Segoe UI",sans-serif; }
.data-prose { color: #565650; font-size: 13px; line-height: 1.9; }
.data-prose p { margin: 0 0 15px; }
.data-prose strong { color: #373730; font-weight: 500; }
.data-prose a { color: #835836; text-decoration: underline; text-underline-offset: 3px; }
.data-prose table { width: 100%; margin: 17px 0; border-collapse: collapse; font-size: 11px; }
.data-prose th, .data-prose td { padding: 9px; border: 1px solid #ddddd3; text-align: left; }
.dialog-tools { display: flex; gap: 11px; flex-wrap: wrap; margin-bottom: 17px; }
.dialog-tools .quiet { padding: 6px 11px; border: 1px solid #d8d7ce; border-radius: 5px; background: #f1f0eb; font-size: 12px; }
.detail-badge { padding: 3px 7px; border-radius: 4px; background: #eee5dc; color: #805836; font-size: 11px; }
.detail-stat-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin: 19px 0; }
.detail-stat-grid span { display: block; color: var(--secondary); font-size: 12px; }
.detail-stat-grid strong { display: block; margin-top: 7px; color: #754d30; font: 400 27px "Segoe UI",sans-serif; }
#optionDetails > p { margin: 15px 0; color: #4c4c44; font-size: 14px; line-height: 1.9; }
.detail-note { color: var(--secondary) !important; font-size: 12px !important; }
.selector-dialog { width: min(820px,94vw); overflow-y: auto; }
.selector-dialog .panel { border-color: #deddd4; background: #f6f6f1; box-shadow: none; }
.selector-dialog .panel-heading { min-height: 58px; padding: 13px 14px; }
.selector-dialog .panel-heading h2 { color: #46463c; font-size: 15px; }
.heading-controls { display: flex; gap: 7px; }
.heading-controls select { max-width: 166px; font-size: 11px; }
.ban-row { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.small-label { color: var(--secondary); font-size: 11px; white-space: nowrap; }
.pill-group { display: flex; flex-wrap: wrap; gap: 7px; }
.pill { padding: 6px 9px; border: 1px solid #d7d6cb; border-radius: 5px; background: #f3f3ec; color: #5c5c50; font-size: 11px; }
.pill.active { border-color: #b4967d; background: #eee5db; color: #7e5330; }
.pill:hover { border-color: #b2a08f; }
.lord-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; padding: 0 13px 13px; }
.lord-card { position: relative; padding: 12px; border: 1px solid #dcdacf; border-radius: 6px; background: #f8f8f1; text-align: left; }
.lord-card.selected { border-color: #b79a80; background: #f0e7dc; }
.lord-card:hover { border-color: #b79a80; }
.lord-top { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.avatar { display: grid; place-items: center; width: 28px; min-width: 28px; height: 28px; border: 1px solid #d5d2c4; border-radius: 5px; background: #eeece3; color: #686150; font-size: 15px; }
.selected .avatar { border-color: #c6aa90; background: #e8d8c6; color: #7b5431; }
.lord-name { color: #3b3b31; font-size: 13px; }
.rank-number { margin-left: auto; color: #757566; font: 10px "Segoe UI",sans-serif; }
.lord-main { display: flex; align-items: end; justify-content: space-between; gap: 7px; }
.lord-main strong { color: #474236; font: 400 24px "Segoe UI",sans-serif; }
.lord-main > span { color: #73715f; font-size: 9px; }
.lord-sub { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; color: #626255; font-size: 10px; }
.roster-bar { display: flex; align-items: flex-start; gap: 11px; max-height: 260px; overflow-y: auto; margin: 12px 0; padding: 12px; border: 1px solid #dcd9c9; border-radius: 6px; background: #f5f4eb; }
.roster-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.hero-chip { padding: 6px 8px; border: 1px solid #d9d4c1; border-radius: 5px; background: #f5f3e9; color: #69624f; font-size: 12px; }
.hero-chip.active { border-color: #b99d7f; background: #ede2d1; color: #7c5931; }
.hero-chip.full { border-color: #a58a69; }
.hero-chip small { margin-left: 5px; color: #71634c; font-size: 10px; }
#targetPlanNote { margin: 0; color: #5e5c50; font-size: 13px; line-height: 1.8; }
.toast { position: fixed; left: 50%; bottom: 14px; z-index: 40; max-width: 86vw; padding: 11px 17px; border: 1px solid #cdc2b7; border-radius: 7px; background: #f7f3ed; color: #6e5137; font-size: 12px; line-height: 1.6; transform: translateX(-50%); box-shadow: 0 8px 28px #32291f1a; }
.toast.error { border-color: #d1afa0; background: #f6eee9; color: #8d5437; }

.candidate-list, .comparison-list, .craft-suggestions, .priority-list, #equipmentLedger, .roster-bar { overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #aaa89e66 transparent; }
*::-webkit-scrollbar { width: 5px; height: 4px; }
*::-webkit-scrollbar-thumb { border-radius: 9px; background: #aaa89e66; }
*::-webkit-scrollbar-thumb:hover { background: #8a8173aa; }
*::-webkit-scrollbar-track { background: transparent; }
button, select, .searchbox, .compare-card, .next-base-hint { transition: color 140ms ease,background-color 170ms ease,border-color 170ms ease,box-shadow 190ms ease,transform 220ms var(--ease); }
button:active:not(:disabled) { transform: scale(.983); }
.candidate-row:active { transform: scale(.995); }
.primary:hover:not(:disabled), .lord-card:hover { transform: translateY(-1px); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid #b28a6a; outline-offset: 2px; }
[tabindex="0"]:focus-visible { outline: 1px solid #b28a6a; outline-offset: -1px; }
.mode-workspace:not([hidden]), [data-gear-panel]:not([hidden]) { animation: desk-in 180ms var(--ease) both; }
.compare-card { animation: card-in 150ms var(--ease) both; }
dialog[open] { animation: dialog-in 230ms var(--ease) both; }
dialog[open]::backdrop { animation: fade-in 160ms ease both; }
.toast:not([hidden]) { animation: toast-in 200ms var(--ease) both; }
@keyframes desk-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.987); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%,5px); } to { opacity: 1; transform: translate(-50%,0); } }

@media (max-width: 1150px) {
  #dashboardWorkspace { grid-template-columns: 1fr; }
  .workspace-tabs { display: flex; }
  .top-actions .quiet, .local-badge, .brand-sub, .filter-note { display: none; }
  body[data-workspace="options"] #equipmentSection, body[data-workspace="equipment"] .mode-workspace { display: none !important; }
  .topbar { gap: 20px; }
  .topbar .filter-field > span { display: none; }
}
@media (max-width: 980px) {
  .selectionbar { height: auto; }
  .ranked-selection { flex-wrap: wrap; gap: 6px 13px; }
  .formation-strip { flex-basis: 100%; width: 100%; padding-left: 0; border-left: 0; }
  .formation-heroes { gap: 10px; }
  .formation-hero { font-size: 12px; }
  .topbar { height: 98px; min-height: 98px; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: 36px 30px; gap: 8px 12px; padding: 10px 12px; }
  .topbar nav { justify-self: start; }
  .topbar .filterbar { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: flex-start; gap: 10px; }
  .top-actions { grid-column: 3; grid-row: 1; justify-self: end; }
  .topbar .filterbar > .refresh { margin-left: auto; }
  main { height: calc(100dvh - 98px); }
}
@media (max-width: 760px) {
  .topbar { gap: 8px 12px; padding: 10px 12px; }
  .brand { gap: 7px; font-size: 22px; }
  .topbar nav { gap: 3px; }
  .nav-button { padding: 6px 8px; font-size: 12px; }
  .new-match { padding: 5px 7px; font-size: 11px; white-space: nowrap; }
  main { height: calc(100dvh - 98px); gap: 9px; padding: 9px; }
  .filterbar { height: 38px; min-height: 38px; gap: 6px; padding: 4px 7px; }
  .filter-field > span { display: none; }
  .filter-field select { max-width: 132px; padding: 4px 18px 4px 5px; font-size: 11px; }
  .filterbar > .refresh, .filterbar #dataPanelBtn { padding: 2px; font-size: 10px; }
  .selectionbar { height: auto; min-height: 38px; gap: 7px; padding: 4px 8px; }
  .context-line { gap: 7px; }
  .context-line select { max-width: 153px; padding: 4px 18px 4px 6px; font-size: 11px; }
  .context-line .tag, #compactSlotSummary { display: none; }
  #chooseLord { font-size: 11px; }
  .workspace-tabs button { padding: 7px 8px; font-size: 12px; }
  .compare-tab { display: block; }
  .workspace-grid { grid-template-columns: 1fr; gap: 0; }
  body[data-options-pane="list"] .mode-workspace .comparison-panel, body[data-options-pane="compare"] .mode-workspace .candidates-panel { display: none !important; }
  .panel-heading { min-height: 54px; padding: 14px 17px 12px; }
  .panel-heading h2 { font-size: 18px; }
  .best-summary:not([hidden]) { display: flex; }
  .primary.wide { padding: 9px 11px; }
  .equipment-section { gap: 8px; padding: 12px; }
  .gear-heading h2 { font-size: 18px; }
  .gear-tabs button { font-size: 11px; }
  .base-card { padding: 6px 3px; font-size: 11px; }
  .craft-copy strong { font-size: 13px; }
  .craft-copy small { max-width: 198px; font-size: 10px; }
  .craft-option .primary { padding: 6px 7px; }
  .saved-indicator { max-width: 147px; font-size: 9px; }
  .loadout-slot { min-height: 125px; padding: 10px 6px; }
  .loadout-slot strong { font-size: 13px; }
  .ledger-heading { min-height: 47px; flex-wrap: wrap; }
  .auction-summary { min-height: 35px; gap: 5px; padding: 5px 7px; }
  .auction-summary strong { display: block; max-width: 95px; overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
  .round-stepper { gap: 3px; }
  .round-dot { width: 17px; min-width: 17px; height: 17px; font-size: 9px; }
  .auction-summary .text-button { font-size: 10px; }
  dialog { padding: 18px; }
  .selector-dialog .panel-heading { gap: 8px; flex-wrap: wrap; }
  .heading-controls { width: 100%; }
  .heading-controls select { max-width: 50%; min-width: 0; flex: 1; }
  .lord-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; padding: 0 11px 11px; }
  .lord-card:last-child { grid-column: span 2; }
  .lord-sub { flex-direction: row; gap: 9px; }
  .ban-row { gap: 9px; }
  .pill-group { gap: 5px; }
  .pill { padding: 5px 7px; font-size: 10px; }
  .lord-card { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
