/* Paint Finder — clean, swatch-led. Dark everywhere.
 *
 * Deliberately not following prefers-color-scheme: the same page looking
 * different on two machines is worse here than either palette is good, and
 * paint swatches need a consistent backdrop to be judged against at all.
 *
 * color-scheme: dark is load-bearing, not decoration — it tells the browser to
 * render native controls (checkboxes, selects, colour pickers, scrollbars) in
 * their dark form. Without it those stay light on a light-mode OS and look
 * pasted onto the page. */
:root {
  color-scheme: dark;

  --bg: #131315;
  --surface: #1c1c1f;
  --surface-2: #232327;
  --text: #f0efec;
  --text-dim: #a3a19c;
  --text-faint: #6f6d68;
  --line: #2e2e33;
  --accent: #e8724a;
  --logo-filter: none;
  --focus: #7aa7d9;
  --danger: #ff6b6b; /* lifted for dark; a light-mode red reads muddy on #131315 */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

:root[data-theme="green"] { --accent: #55b87a; --focus: #71c991; --logo-filter: hue-rotate(78deg) saturate(.9); }
:root[data-theme="blue"] { --accent: #5b9fe8; --focus: #7db4ee; --logo-filter: hue-rotate(175deg) saturate(.9); }
:root[data-theme="purple"] { --accent: #a887e8; --focus: #bca0f0; --logo-filter: hue-rotate(235deg) saturate(.8); }
:root[data-theme="pink"] { --accent: #e77cae; --focus: #ed9ac0; --logo-filter: hue-rotate(305deg) saturate(.8); }
:root[data-theme="red"] { --accent: #d45a50; --focus: #e27b72; --logo-filter: hue-rotate(340deg) saturate(1.15); }
:root[data-theme="gold"] { --accent: #d0a64d; --focus: #dfbd72; --logo-filter: hue-rotate(28deg) saturate(.9); }
:root[data-theme="yellow"] { --accent: #d8b748; --focus: #e5cb72; --logo-filter: hue-rotate(38deg) saturate(1.05); }
:root[data-theme="teal"] { --accent: #4ca8a8; --focus: #73c0c0; --logo-filter: hue-rotate(125deg) saturate(.85); }
:root[data-theme="bone"] { --accent: #c9c29f; --focus: #dbd5b8; --logo-filter: hue-rotate(28deg) saturate(.25) brightness(1.15); }

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.25rem 5rem;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main, .masthead, footer { max-width: 780px; margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- account bar ---- */

.accountbar {
  max-width: 780px;
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  padding-top: 1.25rem;
  min-height: 2.5rem;
  flex-wrap: wrap;
}

.navlinks { display: flex; gap: 1.1rem; }

.navlinks a {
  font-size: .9rem;
  color: var(--text-faint);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.navlinks a:hover { color: var(--text-dim); }
.navlinks a.active { color: var(--text); border-bottom-color: var(--accent); }

#account { display: flex; align-items: center; gap: .6rem; }

.site-logo { filter: var(--logo-filter); }

.accountbar .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.accountbar .who { font-size: .9rem; color: var(--text-dim); }

.sync-warn {
  font-size: .78rem;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  padding: .25rem .6rem;
  cursor: help;
}

.accountbar button,
.accountbar .signin {
  font: inherit;
  font-size: .85rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s;
}

.accountbar button:hover,
.accountbar .signin:hover { border-color: var(--text-faint); }

.nickname-form input { padding:.35rem .5rem; color:var(--text); background:var(--surface); border:1px solid var(--line); border-radius:999px; font:inherit; font-size:.78rem; }
.nickname-form { display:flex; align-items:center; gap:.35rem; }
.nickname-form input { width:10rem; }
.accountbar .account-edit { padding:.28rem .5rem; color:var(--text-faint); font-size:.72rem; }

/* ---- kit actions ---- */

.kit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}

.kit-actions button {
  font: inherit;
  font-size: .85rem;
  padding: .4rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.kit-actions button:hover { border-color: var(--text-faint); }
.kit-actions button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.kit-actions button.danger:hover { border-color: var(--danger); color: var(--danger); }

.shopping-form {
  max-width: 30rem;
  margin-top: .75rem;
  padding: .85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.shopping-form label {
  display: block;
  margin-bottom: .35rem;
  font-size: .82rem;
  color: var(--text-dim);
}

.shopping-form label span { color: var(--text-faint); }

.shopping-form input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: .45rem .6rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.shopping-form input:focus {
  outline: none;
  border-color: var(--focus);
}

.shopping-form-actions { display: flex; gap: .5rem; margin-top: .65rem; }
.shopping-form button {
  font: inherit;
  font-size: .82rem;
  padding: .35rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.shopping-form button:hover { border-color: var(--text-faint); }
.shopping-form button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.shopping-form button.danger:hover { border-color: var(--danger); color: var(--danger); }
.shopping-current { margin: .7rem 0 0; color: var(--text-dim); font-size: .86rem; }

.shopping-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.shopping-controls label {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--text-dim);
  font-size: .85rem;
}

.shopping-controls select,
.shopping-controls button,
.shopping-controls summary {
  font: inherit;
  font-size: .82rem;
  padding: .35rem .65rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.shopping-controls button,
.shopping-controls summary { cursor: pointer; }
.shopping-controls button:hover,
.shopping-controls summary:hover { border-color: var(--text-faint); }
.shopping-controls button:disabled { opacity: .45; cursor: default; }

/* Secondary commands stay one click away without taking over the toolbar. */
.compact-menu { position: relative; }
.compact-menu > summary { list-style: none; user-select: none; }
.compact-menu > summary::-webkit-details-marker { display: none; }
.compact-menu > summary::after { content: "⌄"; margin-left: .4rem; color: var(--text-faint); }
.compact-menu[open] > summary::after { content: "⌃"; }
.compact-menu-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + .4rem);
  right: 0;
  display: grid;
  min-width: 9rem;
  gap: .35rem;
  padding: .45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.compact-menu-panel > * { width: 100%; text-align: left; }

.shopping-list-form {
  display: flex;
  gap: .5rem;
  margin: -.35rem 0 1rem;
}

.shopping-list-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: .4rem .6rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.shopping-list-form input:focus { outline: none; border-color: var(--focus); }
.shopping-list-form button { cursor: pointer; }
.shopping-list-form button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }

@media (max-width: 560px) {
  .shopping-list-form { flex-wrap: wrap; }
  .shopping-list-form input { flex-basis: 100%; }
}

.own-tag {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .6;
  margin-left: .4rem;
}

.dot.own { background: var(--focus); }

.swatch.unknown {
  background: repeating-linear-gradient(45deg, #888 0 4px, #bbb 4px 8px);
}

/* ---- custom scheme editor ---- */

.editor {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.editor h2 { margin: 0 0 .9rem; font-size: 1.05rem; }

.editor input,
.editor select {
  font: inherit;
  font-size: .9rem;
  padding: .4rem .6rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.editor input:focus, .editor select:focus {
  outline: none;
  border-color: var(--focus);
}

.ed-name { width: 100%; margin-bottom: 1rem; font-size: 1rem !important; }

.ed-part {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .8rem;
  margin-bottom: .7rem;
}

.ed-part-head { display: flex; gap: .5rem; margin-bottom: .6rem; }
.ed-part-name { flex: 1; }

.ed-step {
  display: grid;
  grid-template-columns: 7.5rem 8.5rem minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: .4rem;
  margin-bottom: .4rem;
}

.editor button {
  font: inherit;
  font-size: .85rem;
  padding: .35rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.editor button:hover { border-color: var(--text-faint); }
.editor button.danger:hover { border-color: var(--danger); color: var(--danger); }

.editor button.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.ed-add { margin-top: .3rem; }

.ed-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: 1rem;
}

.ed-error { font-size: .85rem; color: var(--danger); }

@media (max-width: 620px) {
  .ed-step { grid-template-columns: 1fr 1fr; }
  .ed-step .ed-note { grid-column: 1 / -1; }
}

/* ---- masthead ---- */

.masthead { padding: 3rem 0 2rem; text-align: center; }

.masthead h1 {
  margin: 0;
  line-height: 0;
}

.site-logo { display: inline-block; width: min(100%, 25rem); height: auto; }

/* ---- search ---- */

.search { position: relative; }

#q {
  width: 100%;
  padding: 1rem 1.15rem;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}

#q::placeholder { color: var(--text-faint); }

#q:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}

#suggestions {
  position: absolute;
  z-index: 20;
  inset-inline: 0;
  top: calc(100% + .5rem);
  margin: 0;
  padding: .35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 22rem;
  overflow-y: auto;
}

#suggestions li {
  padding: .6rem .8rem;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

#suggestions li[aria-selected="true"] { background: var(--surface-2); }

#suggestions .faction {
  color: var(--text-faint);
  font-size: .82rem;
  white-space: nowrap;
}

.faction-mark {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--bg);
  background: var(--accent);
}

#suggestions .none { color: var(--text-dim); cursor: default; }

/* ---- empty state ---- */

.empty { margin-top: 2.5rem; text-align: center; color: var(--text-dim); }

/* ---- recoverable errors ---- */

.app-status {
  max-width: 780px;
  margin: 1rem auto 0;
}

.app-incident {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .75rem .9rem;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--line));
  border-radius: 11px;
  font-size: .78rem;
}

.app-incident strong,
.app-incident span { display: block; }
.app-incident strong { color: var(--text); }
.app-incident span { margin-top: .12rem; }
.app-incident-actions { display: flex; gap: .4rem; flex: 0 0 auto; }
.app-incident button {
  padding: .4rem .65rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}
.app-incident button:hover { border-color: var(--text-faint); }

.recipe-unavailable {
  margin: 1.1rem 0;
  padding: 1rem;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--line));
  border-radius: var(--radius);
}
.recipe-unavailable strong { display: block; color: var(--text); font-size: .95rem; }
.recipe-unavailable p { margin: .2rem 0 0; font-size: .82rem; }
.recipe-unavailable a { color: var(--text-dim); }
.recipe-unavailable.compact { margin:.65rem 0 0; padding:.75rem; }

@media (max-width: 520px) {
  .app-incident { align-items: flex-start; flex-direction: column; }
}

/* ---- result ---- */

#result { margin-top: 3rem; }
.search-detail { padding-top: 1.5rem; }
.search-detail #result { margin-top: 2rem; }

.kit-name {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.kit-meta { color: var(--text-dim); font-size: .92rem; margin-top: .15rem; }

.scheme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.5rem 0 .75rem;
}

.picker-tabs {
  display: flex;
  gap: 1.25rem;
  margin: 1.5rem 0 0;
  border-bottom: 1px solid var(--line);
}

.picker-tabs button {
  font: inherit;
  font-size: .88rem;
  padding: .4rem 0 .5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.picker-tabs button:hover { color: var(--text-dim); }

.picker-tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.picker-tabs + .scheme-picker { margin-top: .9rem; }
.picker-tabs + .scheme-select { margin-top: .9rem; }

.picker-note {
  margin: -.35rem 0 .75rem;
  font-size: .82rem;
  color: var(--text-faint);
}

.scheme-picker button {
  padding: .45rem .9rem;
  font: inherit;
  font-size: .9rem;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}

.scheme-picker button:hover { color: var(--text); }

.scheme-picker button[aria-pressed="true"] {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.scheme-select {
  display: grid;
  grid-template-columns: auto minmax(0, 18rem);
  align-items: center;
  gap: .7rem;
  width: fit-content;
  max-width: 100%;
  margin: 1.5rem 0 .75rem;
  color: var(--text-faint);
  font-size: .78rem;
  font-weight: 600;
}
.scheme-select select {
  min-width: 0;
  padding: .5rem 2rem .5rem .7rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  font-size: .88rem;
}

.provenance {
  font-size: .82rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: 2rem;
}

.recipe-source-note { display:grid; gap:.15rem; margin:-1rem 0 1.25rem; padding:.75rem .9rem; color:var(--text-dim); background:color-mix(in srgb,var(--accent) 6%,var(--surface)); border:1px solid color-mix(in srgb,var(--accent) 28%,var(--line)); border-radius:10px; font-size:.78rem; }
.recipe-source-note strong { color:var(--text); font-size:.8rem; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

/* ---- boxed set contents ---- */

.box-contents {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.box-contents h3 {
  margin: 0 0 .6rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.box-contents ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .5rem;
}

.box-contents li a {
  display: inline-block;
  font-size: .88rem;
  color: var(--text);
  text-decoration: none;
  padding: .3rem .7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.box-contents li a:hover { border-color: var(--text-faint); }

.box-contents .note {
  margin: .8rem 0 0;
  font-size: .82rem;
  color: var(--text-faint);
}

/* ---- parts ---- */

.readiness {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1.25rem 0 .85rem;
}

.readiness-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.readiness h2 {
  margin: 0;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.readiness p {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .4rem 1rem;
  margin: .65rem 0 0;
  font-size: .84rem;
  color: var(--text-dim);
}

.readiness-progress {
  flex: none;
  color: var(--text-faint);
  white-space: nowrap;
}

.readiness-progress strong { color: var(--text); font-weight: 600; }

.readiness-toggle {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}

.readiness-toggle button {
  border: 0;
  border-radius: 999px;
  padding: .42rem .75rem;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}

.readiness-toggle button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}

.readiness-toggle button span {
  color: var(--text-faint);
  margin-left: .25rem;
}

.part {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: .85rem;
  box-shadow: var(--shadow);
}

.part h3 {
  margin: 0 0 .85rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* A boxed patrol is a collection of distinct painting jobs. Two cards per row
   keeps the unit name visually attached to its own recipe without producing a
   single very long, ambiguous paint list. */
.combat-patrol-guides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.combat-patrol-guide {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.combat-patrol-guide > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 5rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--line);
}

.combat-patrol-guide > header h2 {
  display: inline;
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.combat-patrol-guide > header h2 a { color: var(--text); text-decoration: none; }
.combat-patrol-guide > header h2 a:hover { color: var(--accent); }
.combat-patrol-guide > header p { margin: .3rem 0 0; color: var(--text-faint); font-size: .72rem; }
.unit-quantity { margin-right: .2rem; color: var(--accent); font-size: .78rem; font-weight: 700; }
.unit-paint-parts { padding: .65rem; }
.unit-paint-parts .part { padding: .8rem; margin-bottom: .6rem; box-shadow: none; }
.unit-paint-parts .part:last-child { margin-bottom: 0; }
.unit-paint-parts .step { grid-template-columns: 4.4rem auto minmax(0, 1fr); gap: .5rem; }
.unit-paint-parts .stage { font-size: .65rem; }
.unit-paint-parts .step-paint { min-width: 0; }
.unit-paint-parts .paint-name { font-size: .8rem; }

/* ---- faction browse page ---- */
.faction-page { padding-bottom: 2rem; }
.faction-back { display: inline-block; margin-bottom: 1rem; color: var(--text-dim); font-size: .82rem; text-decoration: none; }
.faction-filter-label { display: grid; gap: .4rem; margin: 1.5rem 0 1rem; color: var(--text-faint); font-size: .76rem; font-weight: 600; }
.faction-filter-label input { width: 100%; padding: .72rem .85rem; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.faction-unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; max-height:clamp(26rem,62vh,42rem); padding-right:.3rem; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.faction-unit-card { position: relative; display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 3.3rem; padding: .7rem .9rem .7rem 1.25rem; overflow: hidden; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font-size: .86rem; }
.faction-unit-card:hover { border-color: var(--text-faint); }
.faction-unit-card strong { flex: none; padding: .18rem .42rem; color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 999px; font-size: .66rem; }
.faction-no-results { color: var(--text-dim); text-align: center; }

@media (max-width: 780px) {
  .combat-patrol-guides { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .faction-unit-grid { grid-template-columns: 1fr; }
}

.step {
  display: grid;
  grid-template-columns: 5.5rem auto 1fr;
  align-items: center;
  gap: .75rem;
  padding: .42rem 0;
}

.step + .step { border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }

.step.parade-step {
  margin-inline: -.55rem;
  padding-inline: .55rem;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.stage {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.swatch {
  display: inline-block; /* so width/height hold even outside a flex parent */
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(128,128,128,.35);
  flex: none;
  position: relative;
}

.paint-name { font-size: .97rem; }

.paint-type {
  color: var(--text-faint);
  font-size: .78rem;
  margin-left: .45rem;
}

.step-note {
  grid-column: 2 / -1;
  font-size: .85rem;
  color: var(--text-dim);
  margin-top: -.3rem;
}

@media (max-width: 620px) {
  .readiness-head { align-items: stretch; flex-direction: column; gap: .65rem; }
  .readiness-toggle { width: 100%; }
  .readiness-toggle button { flex: 1; }
}

/* ---- paint view ---- */

.paint-tag { text-transform: capitalize; }

.paint-head { display: flex; align-items: center; gap: 1rem; }

.paint-hero {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid rgba(128,128,128,.35);
  flex: none;
}

.use-group { margin-bottom: 1.5rem; }

.use-saved {
  margin-bottom: 1.75rem;
  padding: .75rem;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: var(--radius);
}

.use-saved h3 {
  margin: 0 0 .35rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.use-saved .use-row { background: var(--surface); }
.use-saved .use-count { color: var(--accent); font-weight: 650; }

.use-group h3 {
  margin: 0 0 .5rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.use-row {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: .75rem;
  padding: .45rem .6rem;
  border-radius: 9px;
}

.use-row:hover { background: var(--surface); }

.use-scheme { color: var(--text); text-decoration: none; font-size: .95rem; }
.use-scheme:hover { color: var(--accent); }

.use-parts {
  font-size: .84rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.use-count { font-size: .8rem; color: var(--text-faint); white-space: nowrap; }

@media (max-width: 600px) {
  .use-row { grid-template-columns: 1fr auto; }
  .use-parts { grid-column: 1 / -1; white-space: normal; }
}

/* ---- pot / spray format badges ---- */

.fmt {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: .08rem .3rem;
  margin-left: .4rem;
  white-space: nowrap;
  vertical-align: middle;
  cursor: help;
}

.fmt.spray {
  color: var(--focus);
  border: 1px solid color-mix(in srgb, var(--focus) 45%, transparent);
}

.fmt.air {
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.fmt.pot {
  color: var(--text-faint);
  border: 1px solid var(--line);
  cursor: default;
}

.paint-formats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .5rem;
}

.paint-formats .fmt { margin-left: 0; }

.fmt-note {
  font-size: .82rem;
  color: var(--text-dim);
  margin-left: .35rem;
}

/* ---- buy links ---- */

.buy { position: relative; flex: none; }

.buy summary {
  list-style: none;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .1rem .3rem;
  line-height: 1.5;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.buy summary::-webkit-details-marker { display: none; }
.buy summary:hover,
.buy[open] summary { color: var(--accent); border-color: var(--accent); }

.buy-options {
  position: absolute;
  z-index: 35;
  right: 0;
  top: calc(100% + .35rem);
  display: grid;
  min-width: 12rem;
  gap: .15rem;
  padding: .35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
}
.buy-options a {
  padding: .35rem .5rem;
  color: var(--text-dim);
  border-radius: 6px;
  font-size: .72rem;
  text-decoration: none;
  white-space: nowrap;
}
.buy-options a:hover { color: var(--text); background: var(--surface-2); }

/* In the recipe the same paints repeat across parts, so three badges per row
   would be permanent noise. Reveal them on hover or keyboard focus instead —
   present everywhere, shouting nowhere. */
.buy.on-hover {
  margin-left: .5rem;
  opacity: 0;
  transition: opacity .12s;
}

.step:hover .buy.on-hover,
.buy.on-hover:focus-within,
.buy.on-hover[open] { opacity: 1; }

.step.owned .buy { display: none; }

@media (hover: none) {
  /* No hover on touch — show the single compact Buy control. */
  .buy.on-hover { opacity: 1; }
}

.step-paint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.paint-ownership {
  flex: none;
  margin-left: .55rem;
  padding: .12rem .48rem;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: .7rem;
  font-weight: 650;
  line-height: 1.45;
  cursor: pointer;
}

.paint-format-ownership {
  display: inline-flex;
  flex: none;
  gap: .25rem;
  margin-left: .55rem;
}

.paint-format-ownership .paint-ownership { margin-left: 0; }
.kit-actions > .paint-format-ownership { margin-left: 0; }
.kit-actions > .paint-format-ownership .paint-ownership { padding: .4rem .75rem; font-size: .78rem; }

.paint-ownership:hover { border-color: var(--accent); }

.paint-ownership[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--focus) 55%, var(--line));
  color: var(--focus);
  background: color-mix(in srgb, var(--focus) 8%, transparent);
}

.paint-ownership:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---- collection shopping rows ---- */

.shop-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Scoped to .shop-row, not .shopping — the aggregated list on the collection
   page reuses these rows outside that wrapper, and without this the label
   stayed inline and squashed the swatch to a sliver. */
.shop-row label {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex: none;
  cursor: pointer;
  padding: .3rem .35rem;
  border-radius: 8px;
}

.shop-row label:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }

/* Already owned — nothing to buy, so retailer links go away. */
.shop-row label.owned ~ .buy { display: none; }

.shop-row input { width: 16px; height: 16px; accent-color: var(--focus); cursor: pointer; }

/* The name now lives outside the label, so ownership styling keys off the row. */
.shop-row.owned .paint-name { color: var(--text-faint); text-decoration: line-through; }
.shop-row.owned .paint-type,
.shop-row.owned .fmt { opacity: .5; }
.shop-row label.owned .swatch { opacity: .4; }

.shop-name { flex: 1; min-width: 0; display: flex; align-items: center; }

.paint-link { color: inherit; text-decoration: none; }

.paint-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tally { margin-top: 1rem; font-size: .86rem; color: var(--text-dim); }

/* ---- colour signature ---- */

/* A kit's identity, built from its own paints. Horizontal by default; .sig-v is
   the vertical spine used down the left edge of a collection card. */
.sig {
  display: flex;
  overflow: hidden;
  border-radius: 4px;
  flex: none;
}

.sig > span { display: block; }

.sig-sm { width: 28px; height: 10px; }
.sig-sm > span { flex: 1; }

.sig-lg {
  width: 100%;
  max-width: 240px;
  height: 8px;
  margin-top: .8rem;
  border-radius: 999px;
}
.sig-lg > span { flex: 1; }

/* Flush to the card's left edge rather than floating inside it — a spine, so
   the colours read as belonging to the whole row. */
.sig-v {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  flex-direction: column;
  width: 6px;
  border-radius: var(--radius) 0 0 var(--radius);
}
.sig-v > span { flex: 1; }

.sug-main { display: flex; align-items: center; gap: .6rem; min-width: 0; }

/* ---- my collection ---- */

#collection { max-width: 780px; margin-inline: auto; padding-top: 2.5rem; }

.c-title {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -.025em;
}

.c-sub { margin: .3rem 0 0; color: var(--text-dim); font-size: .95rem; }

.c-panel { margin-top: 1.5rem; }
.c-panel-overview { margin-top: 1.25rem; }

.collection-back {
  display: inline-block;
  margin-bottom: .65rem;
  color: var(--text-faint);
  font-size: .82rem;
  text-decoration: none;
}

.collection-back:hover { color: var(--accent); }

/* Settings live with the collection instead of crowding the global account
   bar. Large labeled swatches are easier to compare than a color-name select. */
.settings-section { padding:.2rem 0 1rem; }
.settings-section + .settings-section { margin-top:1.25rem; padding-top:1.25rem; border-top:1px solid var(--line); }
.settings-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; margin-bottom:1rem; }
.settings-heading h2 { margin:0; font-size:1.05rem; }
.settings-heading p { margin:.25rem 0 0; max-width:34rem; color:var(--text-dim); font-size:.82rem; }
.settings-current { flex:none; padding:.25rem .5rem; color:var(--text-faint); background:var(--surface-2); border-radius:999px; font-size:.68rem; }
.theme-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; }
.backup-actions { display:flex; flex-wrap:wrap; gap:.65rem; margin-top:.9rem; }
.button-label { display:inline-flex; align-items:center; justify-content:center; min-height:2.45rem; padding:.52rem .85rem; border:1px solid var(--line-strong); border-radius:.55rem; background:var(--surface-2); color:var(--text); font-size:.82rem; font-weight:650; cursor:pointer; }
.button-label:hover { border-color:var(--accent); }
.button-label input { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.backup-status { margin:.8rem 0 0; padding:.65rem .75rem; border-radius:.55rem; background:var(--surface-2); color:var(--text-dim); font-size:.8rem; }
.backup-status.success { border-left:3px solid var(--success,#64a96b); }
.backup-status.error { border-left:3px solid var(--danger,#cf5b5b); }
.backup-status.working { border-left:3px solid var(--accent); }
.theme-choice { position:relative; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:.7rem; min-height:3.7rem; padding:.7rem .8rem; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); cursor:pointer; transition:border-color .15s,transform .1s; }
.theme-choice:hover { border-color:var(--text-faint); }
.theme-choice:active { transform:translateY(1px); }
.theme-choice:has(input:checked) { border-color:var(--accent); background:color-mix(in srgb,var(--accent) 6%,var(--surface)); }
.theme-choice input { position:absolute; width:1px; height:1px; opacity:0; }
.theme-choice:has(input:focus-visible) { outline:2px solid var(--focus); outline-offset:2px; }
.theme-swatch { width:2rem; height:2rem; border-radius:50%; background:var(--theme-preview); border:1px solid color-mix(in srgb,var(--theme-preview) 60%,white); box-shadow:inset 0 0 0 4px color-mix(in srgb,var(--theme-preview) 72%,#151517); }
.theme-name { min-width:0; color:var(--text); font-size:.84rem; font-weight:600; }
.theme-check { color:var(--text-faint); font-size:.68rem; }
.theme-choice:has(input:checked) .theme-check { color:var(--accent); }
.settings-note { margin:1rem 0 0; color:var(--text-faint); font-size:.72rem; }

@media (max-width:560px) {
  .settings-heading { flex-direction:column; }
  .theme-grid { grid-template-columns:1fr; }
}

/* the aggregated shopping list */

.shopping-all { list-style: none; margin: 0; padding: 0; }

.shopping-all .shop-row {
  padding: .3rem .35rem;
  border-radius: 9px;
  flex-wrap: wrap;
}

.shopping-all .shop-row:hover { background: var(--surface); }

.shopping-list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: .85rem;
  row-gap: .35rem;
  padding: .65rem .5rem !important;
  border-bottom: 1px solid var(--line);
}

.shopping-list-row:last-child { border-bottom: 0; }

.shopping-check {
  padding: .25rem .2rem !important;
}

.shopping-paint,
.shopping-paint .shop-name { min-width: 0; }

.shopping-paint .shop-name {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: .5rem;
  line-height: 1.35;
}

.shopping-paint .paint-name {
  min-width: 0;
  white-space: normal;
  overflow-wrap: normal;
}

.shopping-paint .paint-type { margin-left: 0; }

.shopping-context {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .15rem .7rem;
  margin-top: .2rem;
  min-width: 0;
}

.need-for {
  flex: none;
  font-size: .78rem;
  color: var(--text-faint);
  white-space: nowrap;
  cursor: help;
}

.shopping-note {
  flex: none;
  min-width: 0;
  color: var(--text-dim);
  font-size: .82rem;
  overflow-wrap: anywhere;
}

.shopping-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex: none;
}

.shopping-actions .paint-format-ownership { margin-left: 0; }
.shopping-actions .paint-ownership { padding: .12rem .4rem; }

.shopping-remove {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  padding: .2rem .35rem;
  cursor: pointer;
  order: 2;
}

.shopping-remove:hover { color: var(--danger); }

.shopping-actions .buy { order: 1; }

.c-owned-row .shop-name {
  overflow-wrap: normal;
  white-space: normal;
}

.c-owned-row .c-drop { flex: none; }

@media (max-width: 560px) {
  .need-for { display: none; }

  .shopping-list-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .shopping-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}

.c-head {
  margin: 2.75rem 0 .9rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--line);
}

.c-lede { margin: 0 0 1rem; color: var(--text-dim); font-size: .92rem; }

.c-empty {
  margin: 0;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: .92rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* saved kits */

.c-kits { display: flex; flex-direction: column; gap: .6rem; }

.c-kit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: .9rem 1.15rem .9rem 1.6rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .1s;
}

.c-kit:hover { border-color: var(--text-faint); }
.c-kit:active { transform: translateY(1px); }
.c-kit.complete { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.c-kit-main { display: flex; flex-direction: column; min-width: 0; }
.c-kit-name { font-weight: 600; font-size: .98rem; }
.c-kit-meta { font-size: .82rem; color: var(--text-faint); margin-top: .1rem; }

.c-kit-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
  flex: none;
  width: 8.5rem;
}

.c-kit-progress .bar {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.c-kit-progress .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .25s;
}

.c-kit-count { font-size: .78rem; color: var(--text-faint); white-space: nowrap; }
.c-kit.complete .c-kit-count { color: var(--accent); }

/* paints owned */

.owned-paint-search {
  margin-bottom: 1.35rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.owned-paint-search > label {
  display: block;
  margin-bottom: .45rem;
  color: var(--text-dim);
  font-size: .84rem;
  font-weight: 600;
}

.owned-paint-search input {
  width: 100%;
  padding: .65rem .75rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: .9rem;
}

.owned-paint-search input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.owned-paint-results { margin-top: .65rem; }

.owned-paint-hint {
  margin: .55rem 0 0;
  color: var(--text-faint);
  font-size: .82rem;
}

.owned-paint-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  padding: .5rem .15rem;
}

.owned-paint-result + .owned-paint-result { border-top: 1px solid var(--line); }

.owned-paint-result .swatch { width: 26px; height: 26px; }

.owned-paint-result-name {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .15rem .5rem;
  min-width: 0;
}

.owned-paint-result-name .paint-name {
  white-space: normal;
  overflow-wrap: normal;
}

.paint-format-alias {
  color: var(--focus);
  font-size: .76rem;
}

.owned-paint-add {
  padding: .28rem .7rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: .8rem;
  font-weight: 650;
  cursor: pointer;
}

.owned-paint-add:hover,
.owned-paint-add:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.c-group { margin-bottom: 1.5rem; }

.c-group h3 {
  margin: 0 0 .6rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.c-count {
  color: var(--text-faint);
  font-weight: 400;
  margin-left: .35rem;
}

.c-paints {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.c-paint-row {
  display: flex;
  align-items: stretch;
  gap: .3rem;
  flex: 0 1 auto;
}

.c-paint {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex: 0 1 auto;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  padding: .4rem .6rem;
  font: inherit;
  font-size: .88rem;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: border-color .15s, color .15s;
}

.c-paint .paint-name {
  flex: 0 1 auto;
  min-width: 0;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: normal;
}

.c-paint:hover { border-color: var(--text-faint); color: var(--accent); }

.c-drop {
  flex: none;
  padding: .35rem .65rem;
  font: inherit;
  font-size: .78rem;
  font-weight: 650;
  line-height: 1;
  color: #fff;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.c-drop:hover { color: var(--danger); border-color: var(--danger); }

.undo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1rem;
  padding: .65rem .8rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: .86rem;
}

.undo-banner button {
  flex: none;
  padding: .3rem .7rem;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 7px;
  font: inherit;
  font-size: .8rem;
  font-weight: 650;
  cursor: pointer;
}

.undo-banner button:hover { border-color: #fff; }

@media (hover: none) { .c-drop { opacity: 1; } }

/* custom schemes */

.c-schemes { list-style: none; margin: 0; padding: 0; }

.c-schemes li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: .5rem;
}

.c-open {
  font-size: .85rem;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .3rem .8rem;
  flex: none;
}

.c-open:hover { color: var(--text); border-color: var(--text-faint); }

.c-scheme-main { display: flex; flex-direction: column; min-width: 0; gap: .1rem; }
.c-scheme-actions { display: flex; align-items: center; gap: .5rem; flex: none; }

.c-schemes button,
.c-share button {
  font: inherit;
  font-size: .85rem;
  padding: .35rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex: none;
}

.c-schemes button:hover,
.c-share button:hover { border-color: var(--text-faint); }
.c-schemes button:disabled,
.c-share button:disabled { opacity: .5; cursor: default; }

/* sharing */

.c-share {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.15rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.c-share strong { font-size: .95rem; font-weight: 600; }
.c-share p { margin: .25rem 0 0; font-size: .86rem; color: var(--text-dim); }

.c-link {
  margin-top: .6rem;
  width: 100%;
  max-width: 30rem;
  font: inherit;
  font-size: .82rem;
  font-family: ui-monospace, Menlo, monospace;
  padding: .4rem .6rem;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.c-link:focus { outline: none; border-color: var(--focus); color: var(--text); }

.c-paint.static { cursor: default; }
.c-paint.static:hover { border-color: var(--line); }

@media (max-width: 560px) {
  .c-share { flex-direction: column; align-items: stretch; }
  .c-schemes li { flex-direction: column; align-items: stretch; gap: .7rem; }
}

@media (max-width: 520px) {
  .c-kit { flex-direction: column; align-items: stretch; gap: .7rem; }
  .c-kit-progress { width: 100%; align-items: stretch; }
  .c-kit-count { text-align: right; }
}

/* ---- hobby projects and model inventory ---- */
.project-summary { display:flex; gap:.65rem; flex-wrap:wrap; margin-bottom:1rem; }
.project-summary > * { padding:.45rem .7rem; border:1px solid var(--line); border-radius:999px; color:var(--text-dim); font-size:.78rem; }
.hobby-progress { margin:.2rem 0 1.35rem; padding:1rem; border:1px solid var(--line); border-radius:.75rem; background:var(--surface-1); }
.hobby-progress-head { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; }
.hobby-progress-head h2 { margin:0; font-size:.95rem; }
.hobby-progress-head p { margin:.25rem 0 0; color:var(--text-dim); font-size:.8rem; }
.hobby-progress-head > span { color:var(--text-faint); font-size:.78rem; }
.hobby-progress-bar { height:.45rem; margin:.8rem 0; overflow:hidden; border-radius:999px; background:var(--surface-2); }
.hobby-progress-bar span { display:block; height:100%; border-radius:inherit; background:var(--accent); }
.hobby-progress-stages { display:flex; flex-wrap:wrap; gap:.45rem 1rem; color:var(--text-faint); font-size:.76rem; }
.hobby-progress-stages strong { color:var(--text-dim); }
.model-add-form { display:grid; grid-template-columns:minmax(14rem,1fr) 8rem 7rem auto; gap:.65rem; align-items:end; margin:1rem 0 1.25rem; padding:1rem; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.model-add-form label,.model-progress-fields label { display:grid; gap:.3rem; color:var(--text-faint); font-size:.72rem; }
.model-add-form input,.model-add-form select,.model-progress-fields input { min-width:0; padding:.55rem; color:var(--text); background:var(--bg); border:1px solid var(--line); border-radius:7px; font:inherit; }
.model-inventory-list { display:grid; gap:.7rem; }
.model-inventory-card { display:grid; grid-template-columns:minmax(12rem,1fr) auto auto; gap:1rem; align-items:center; padding:.85rem 1rem; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.model-progress-fields { display:flex; gap:.45rem; }
.model-progress-fields input { width:4rem; }
.model-card-actions { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
.model-box-version { display:inline-flex; width:fit-content; margin-top:.3rem; padding:.18rem .42rem; color:var(--text-dim); background:var(--surface-2); border:1px solid var(--line); border-radius:999px; font-size:.66rem; }
.model-box-units { display:block; max-width:42rem; margin-top:.32rem; color:var(--text-faint); font-size:.7rem; line-height:1.45; }
.box-contents-editor { grid-column:1 / -1; padding-top:.85rem; border-top:1px solid var(--line); }
.box-editor-head { display:flex; align-items:end; justify-content:space-between; gap:1rem; }
.box-editor-head p { margin:.2rem 0 0; color:var(--text-dim); font-size:.75rem; }
.box-editor-head label { display:grid; gap:.25rem; color:var(--text-faint); font-size:.7rem; }
.box-editor-head input,.box-editor-add select,.box-editor-row input { min-width:0; padding:.48rem .55rem; color:var(--text); background:var(--bg); border:1px solid var(--line); border-radius:7px; font:inherit; }
.box-editor-rows { display:grid; gap:.4rem; margin-top:.75rem; }
.box-editor-row { display:grid; grid-template-columns:minmax(12rem,1fr) 6rem auto; gap:.55rem; align-items:end; padding:.55rem .65rem; background:var(--surface-2); border-radius:8px; }
.box-editor-row > span { align-self:center; font-size:.82rem; }
.box-editor-row label { display:grid; gap:.2rem; color:var(--text-faint); font-size:.66rem; }
.box-editor-row input { width:100%; }
.box-editor-add,.box-editor-actions { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; margin-top:.65rem; }
.box-editor-add select { flex:1 1 16rem; }
.box-editor-actions { justify-content:flex-end; }
.army-project-card { display:grid; grid-template-columns:minmax(12rem,1fr) auto; gap:.75rem 1.25rem; align-items:center; padding:1rem 1.15rem; overflow:visible; }
.army-project-card .c-kit-main { grid-column:1; grid-row:1; }
.army-project-readiness { grid-column:1; grid-row:2; display:flex; flex-wrap:wrap; gap:.35rem .6rem; color:var(--text-faint); font-size:.78rem; }
.army-project-readiness span { display:inline-flex; align-items:center; gap:.25rem; padding:.28rem .5rem; border-radius:999px; background:var(--surface-2); white-space:nowrap; }
.army-project-readiness strong { color:var(--text-dim); }
.army-project-readiness .army-project-warning { color:var(--warning, #d9a441); background:color-mix(in srgb, var(--warning, #d9a441) 10%, var(--surface-2)); }
.army-project-card .model-card-actions { grid-column:2; grid-row:1 / span 2; justify-content:flex-end; }
.army-project-card .model-card-actions > a,
.army-project-card .model-card-actions > button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:2rem;
  padding:.4rem .7rem;
  color:var(--text);
  background:var(--surface-2);
  border:1px solid var(--line);
  border-radius:7px;
  font:inherit;
  font-size:.75rem;
  line-height:1;
  text-decoration:none;
  cursor:pointer;
}
.army-project-card .model-card-actions > a:hover,
.army-project-card .model-card-actions > button:hover { border-color:var(--text-faint); }
.army-project-card .model-card-actions > button.danger:hover { color:var(--danger); border-color:var(--danger); }
.army-project-card .c-link { max-width:16rem; }
.c-section-title { margin:2rem 0 .75rem; font-size:1rem; }
.inventory-form-note { margin:-.8rem 0 1.2rem; color:var(--text-faint); font-size:.75rem; }
.collection-hub-group { margin-top:1.35rem; }
.collection-hub-group:first-of-type { margin-top:1.1rem; }
.collection-hub-group h2 { margin:0 0 .55rem; color:var(--text-faint); font-size:.72rem; font-weight:650; letter-spacing:.1em; text-transform:uppercase; }
.collection-overview-links { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.7rem; }
.collection-overview-links a { display:flex; flex-direction:column; gap:.3rem; padding:.85rem 1rem; color:var(--text); background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); text-decoration:none; transition:border-color .15s,transform .1s; }
.collection-overview-links a:hover { border-color:var(--text-faint); }
.collection-overview-links a:active { transform:translateY(1px); }
.collection-overview-links span { color:var(--text-faint); font-size:.76rem; line-height:1.35; }
.collection-link-head { display:flex; align-items:center; justify-content:space-between; gap:.75rem; }
.collection-link-head strong { color:var(--text); font-size:.9rem; }
.collection-link-head .collection-link-count { flex:none; min-width:1.55rem; padding:.1rem .42rem; color:var(--accent); background:color-mix(in srgb,var(--accent) 10%,var(--surface-2)); border-radius:999px; font-size:.7rem; font-weight:700; text-align:center; }
.owned-unit-list { display:grid; gap:.7rem; }
.owned-unit-card { padding:1rem; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); }
.owned-unit-head { display:flex; align-items:start; justify-content:space-between; gap:1rem; }
.owned-unit-head h3 { margin:0; font-size:1rem; }
.owned-unit-head p { margin:.2rem 0 0; color:var(--text-faint); font-size:.78rem; }
.owned-unit-head > a { flex:none; font-size:.78rem; }
.unit-progress-summary { display:flex; flex-wrap:wrap; gap:.35rem; margin-top:.75rem; }
.unit-progress-summary span,
.unit-progress-summary button { padding:.25rem .45rem; color:var(--text-faint); background:var(--surface-2); border:1px solid transparent; border-radius:999px; font:inherit; font-size:.68rem; }
.unit-progress-summary button { cursor:pointer; }
.unit-progress-summary button:hover { color:var(--text); border-color:var(--text-faint); }
.unit-progress-summary button:active { transform:translateY(1px); }
.unit-progress-summary button:disabled { cursor:default; opacity:.55; }
.unit-progress-summary strong { color:var(--text-dim); }
.unit-sources { display:flex; flex-wrap:wrap; gap:.35rem; margin:.7rem 0 0; padding:0; list-style:none; }
.unit-sources li { padding:.28rem .48rem; color:var(--text-dim); border:1px solid var(--line); border-radius:7px; font-size:.7rem; }
.unit-sources li span { display:block; margin-top:.1rem; color:var(--text-faint); font-size:.62rem; }
.unit-direct-editor { display:grid; grid-template-columns:minmax(9rem,1fr) auto auto; gap:.65rem; align-items:center; margin-top:.7rem; padding:.65rem; background:var(--surface-2); border-radius:8px; }
.unit-direct-editor > span { color:var(--text-dim); font-size:.72rem; }
@media (max-width:760px) {
  .model-add-form,.model-inventory-card { grid-template-columns:1fr; }
  .model-progress-fields { display:grid; grid-template-columns:repeat(4,1fr); }
  .model-progress-fields input { width:100%; }
  .army-project-card { grid-template-columns:1fr; }
  .army-project-card .c-kit-main,.army-project-readiness,.army-project-card .model-card-actions { grid-column:1; grid-row:auto; }
  .army-project-card .model-card-actions { justify-content:flex-start; padding-top:.2rem; }
  .army-project-readiness span { white-space:normal; }
  .box-editor-head { align-items:stretch; flex-direction:column; }
  .box-editor-row { grid-template-columns:1fr 5rem auto; }
  .unit-direct-editor { grid-template-columns:1fr; }
}

@media (max-width:520px) {
  .collection-overview-links { grid-template-columns:1fr; }
  .owned-unit-head { flex-direction:column; }
  .box-editor-row { grid-template-columns:1fr 5rem; }
  .box-editor-row button { grid-column:1 / -1; justify-self:start; }
  .box-editor-actions { align-items:stretch; flex-direction:column; }
  .box-editor-actions button { width:100%; }
}

/* ---- army builder ---- */

.army-page { padding-bottom: 3rem; }
.army-shell,
.army-page footer,
.army-main { max-width: 1180px; }

.points-version,
.device-note,
.catalogue-count {
  color: var(--text-faint);
  font-size: .78rem;
}

.army-masthead { padding: 2.4rem 0 1.8rem; }
.army-masthead .site-logo { width: min(100%, 19rem); }
.army-masthead a { display: inline-block; line-height: 0; }

.army-toolbar,
.army-summary,
.army-catalogue-panel,
.army-roster-panel,
.points-source-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.army-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  padding: 1.5rem;
}

.eyebrow {
  margin: 0 0 .2rem;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.army-toolbar h1,
.army-section-head h2 { margin: 0; line-height: 1.2; }
.army-toolbar h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); }
.army-toolbar-copy > p:last-child {
  max-width: 35rem;
  margin: .45rem 0 0;
  color: var(--text-dim);
  font-size: .92rem;
}

.army-controls {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex: none;
}

.army-controls fieldset,
.roster-addons,
.roster-wargear {
  margin: 0;
  padding: 0;
  border: 0;
}

.army-controls legend,
.army-field > span,
.roster-row-controls label,
.roster-addons legend,
.roster-wargear legend {
  display: block;
  margin-bottom: .35rem;
  color: var(--text-dim);
  font-size: .75rem;
  font-weight: 600;
}

.target-toggle {
  display: flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.target-toggle button {
  padding: .47rem .72rem;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
}

.target-toggle button[aria-pressed="true"] {
  color: var(--bg);
  background: var(--text);
}

.army-field select,
.unit-search,
.roster-row select {
  padding: .55rem .7rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  font-size: .86rem;
}

.army-field select { min-width: 13rem; }
.army-field select:focus,
.unit-search:focus,
.roster-row select:focus {
  outline: 0;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.army-error {
  margin-top: 1rem;
  padding: .8rem 1rem;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  border-radius: 10px;
}

.army-templates {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}

.template-card {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-width: 0;
  padding: .9rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.template-card-head,
.template-points,
.template-card-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.template-card h3 { margin: 0; font-size: .96rem; line-height: 1.25; }
.template-kind {
  flex: none;
  padding: .18rem .42rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.template-kind.competitive {
  color: var(--focus);
  background: color-mix(in srgb, var(--focus) 9%, transparent);
  border-color: color-mix(in srgb, var(--focus) 32%, var(--line));
}
.template-summary { margin: 0; color: var(--text-dim); font-size: .78rem; line-height: 1.45; }
.template-points { align-items: baseline; justify-content: flex-start; }
.template-points strong { color: var(--text); font-size: 1.05rem; }
.template-points span { color: var(--text-faint); font-size: .68rem; }
.template-points .changed { color: var(--accent); }
.template-meta {
  display: flex;
  gap: .35rem;
  margin: 0;
  flex-wrap: wrap;
}
.template-meta span {
  padding: .2rem .4rem;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: .64rem;
}
.template-card details { color: var(--text-faint); font-size: .7rem; }
.template-card summary { color: var(--text-dim); cursor: pointer; }
.template-card details p { margin: .45rem 0 0; line-height: 1.45; }
.template-source { color: var(--text-dim); overflow-wrap: anywhere; }
.template-source:hover { color: var(--text); }
.template-card-actions { align-items: center; margin-top: auto; }
.template-card-actions small { color: var(--text-faint); font-size: .63rem; }
.template-load {
  flex: none;
  padding: .45rem .7rem;
  color: var(--bg);
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: 8px;
  font: inherit;
  font-size: .74rem;
  font-weight: 650;
  cursor: pointer;
}
.template-load:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.template-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.2rem;
  color: var(--text-dim);
  border: 1px dashed var(--line);
  border-radius: 9px;
  font-size: .8rem;
  text-align: center;
}

.template-context {
  margin-bottom: .75rem;
  padding: .75rem .8rem;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 9px;
  font-size: .72rem;
  line-height: 1.45;
}
.template-context strong { display: block; color: var(--text); font-size: .78rem; }
.template-context p { margin: .2rem 0 0; }
.template-context a { color: var(--accent); }

.list-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-bottom: 1rem;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.list-tabs button {
  padding: .5rem .7rem;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: .78rem;
  font-weight: 650;
  cursor: pointer;
}

.list-tabs button[aria-selected="true"] {
  color: var(--bg);
  background: var(--text);
}

.list-tabs button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.premade-intro {
  margin-bottom: .75rem;
  padding: .2rem .1rem;
}
.premade-intro strong { color: var(--text); font-size: .86rem; }
.premade-intro p {
  margin: .25rem 0 0;
  color: var(--text-dim);
  font-size: .74rem;
  line-height: 1.45;
}

.army-summary {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) auto auto;
  align-items: center;
  gap: 2rem;
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}

.army-total { display: flex; align-items: baseline; gap: .45rem; }
.army-total strong { font-size: 1.85rem; line-height: 1; }
.army-total span { color: var(--text-faint); font-size: .86rem; }

.points-progress {
  width: 100%;
  height: 5px;
  margin-top: .65rem;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 999px;
}

.points-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width .2s ease;
}

.points-progress span.over { background: var(--danger); }
.points-message { margin: .3rem 0 0; color: var(--text-dim); font-size: .76rem; }
.points-message.over { color: var(--danger); }

.army-stats { display: flex; gap: 1.5rem; margin: 0; }
.army-stats div { min-width: 4.5rem; }
.army-stats dt { color: var(--text-faint); font-size: .7rem; }
.army-stats dd { margin: -.05rem 0 0; font-size: 1.25rem; font-weight: 700; }
.army-stats dd.complete { color: var(--accent); }

.army-summary-actions { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.army-summary-actions input { min-width:10rem; padding:.45rem .65rem; color:var(--text); background:var(--bg); border:1px solid var(--line); border-radius:8px; font:inherit; }
.army-import { padding:.45rem .75rem; border:1px solid var(--line); border-radius:8px; cursor:pointer; font-size:.78rem; }
.army-import input { position:absolute; width:1px; height:1px; opacity:0; }
.army-metadata { display:grid; grid-template-columns:1fr 1fr 2fr; gap:.6rem; margin-bottom:.85rem; }
.army-metadata label { display:grid; gap:.25rem; color:var(--text-faint); font-size:.68rem; }
.army-metadata input { min-width:0; padding:.5rem; color:var(--text); background:var(--bg); border:1px solid var(--line); border-radius:7px; }
.army-checks {
  margin-bottom:.85rem;
  padding:.7rem .8rem;
  color:var(--text-dim);
  background:var(--surface-2);
  border:1px solid var(--line);
  border-radius:9px;
  font-size:.72rem;
}
.army-checks.clear { display:flex; align-items:baseline; gap:.5rem; border-color:color-mix(in srgb, var(--accent) 45%, var(--line)); }
.army-checks.clear strong { color:var(--accent); }
.army-checks-head { display:flex; justify-content:space-between; gap:.75rem; }
.army-checks-head a { color:var(--accent); text-decoration:none; }
.army-checks-head a:hover { text-decoration:underline; }
.army-checks ul { display:grid; gap:.35rem; margin:.55rem 0 0; padding:0; list-style:none; }
.army-checks li { display:grid; grid-template-columns:minmax(9rem, .65fr) minmax(12rem, 1.35fr); gap:.6rem; }
.army-checks li strong { color:var(--text); }
.army-checks li.error strong { color:var(--danger); }
.army-checks li.review strong { color:var(--warning, #d9a441); }
.army-summary-actions button,
.army-summary-actions summary,
.remove-unit {
  padding: .45rem .75rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
}

.army-summary-actions button:hover,
.army-summary-actions summary:hover,
.remove-unit:hover { border-color: var(--text-faint); }
.army-summary-actions button.danger:hover,
.remove-unit:hover { color: var(--danger); border-color: var(--danger); }
.army-summary-actions button:disabled { opacity: .4; cursor: default; }
.army-more-actions .compact-menu-panel { min-width: 10.5rem; }
.army-more-actions .army-import { display:block; background:var(--surface-2); }
.copy-status { width: 100%; min-height: 1em; color: var(--accent); font-size: .72rem; text-align: right; }

.army-grid {
  display: grid;
  grid-template-columns: minmax(19rem, .8fr) minmax(24rem, 1.2fr);
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.army-catalogue-panel,
.army-roster-panel { min-width: 0; padding: 1.25rem; }
.army-catalogue-panel {
  display: flex;
  flex-direction: column;
  height: clamp(32rem, 68vh, 48rem);
  overflow: hidden;
}
.army-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}
.army-section-head h2 { font-size: 1.15rem; }

.unit-search {
  width: 100%;
  margin-bottom: .75rem;
  background: var(--bg);
}

.unit-catalogue {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: .55rem;
  min-height: 0;
  padding-right: .25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: var(--line) transparent;
}

.unit-card,
.roster-row {
  padding: .85rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.unit-card-head,
.roster-row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .8rem;
}

.unit-card h3,
.roster-row h3 { margin: 0; font-size: .92rem; line-height: 1.25; }
.unit-card-head span,
.roster-row-head span { color: var(--text-faint); font-size: .7rem; }
.unit-card-status {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: .28rem;
  flex-direction: column;
}
.unit-ownership {
  display: inline-flex;
  width: fit-content;
  margin-top: .28rem;
  padding: .18rem .4rem;
  color: var(--text-dim) !important;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .65rem !important;
  font-style: normal;
  line-height: 1.2;
  white-space: nowrap;
}
.unit-ownership.complete {
  color: var(--accent) !important;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}
.unit-ownership.missing {
  color: var(--warning, #d9a441) !important;
  border-color: color-mix(in srgb, var(--warning, #d9a441) 55%, var(--line));
}
.army-unit-progress { display:flex; flex-wrap:wrap; gap:.28rem; margin-top:.4rem; }
.army-unit-progress button {
  padding:.2rem .42rem;
  color:var(--text-faint);
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:999px;
  font:inherit;
  font-size:.65rem;
  line-height:1.2;
  cursor:pointer;
}
.army-unit-progress button strong { color:var(--text-dim); }
.army-unit-progress button:hover { color:var(--text); border-color:var(--text-faint); }
.army-unit-progress button:active { transform:translateY(1px); }
.army-unit-progress button:disabled { cursor:default; opacity:.5; }
.unit-condition {
  display: block;
  margin-top: .2rem;
  color: var(--text-dim);
  font-size: .65rem;
  font-style: normal;
  line-height: 1.3;
}

.recipe-link,
.roster-recipe {
  flex: none;
  color: var(--accent);
  font-size: .72rem;
  text-decoration: none;
}
.recipe-link:hover,
.roster-recipe:hover { text-decoration: underline; }

.unit-add-options {
  display: flex;
  gap: .4rem;
  margin-top: .65rem;
  flex-wrap: wrap;
}

.unit-add-options button {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  flex: 1 1 9.5rem;
  padding: .45rem .6rem;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: .74rem;
  cursor: pointer;
}
.unit-add-options button:hover { color: var(--text); border-color: var(--accent); }
.unit-add-options strong { color: var(--text); white-space: nowrap; }
.unit-addon-note { margin: .45rem 0 0; color: var(--text-faint); font-size: .68rem; }
.loading-note,
.catalogue-empty { color: var(--text-dim); font-size: .86rem; text-align: center; }

.army-roster { display: flex; flex-direction: column; gap: .65rem; }
.roster-empty {
  padding: 4rem 1rem;
  color: var(--text-dim);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.roster-empty strong { color: var(--text); font-size: .92rem; }
.roster-empty p { margin: .25rem 0 0; font-size: .8rem; }

.roster-points { color: var(--accent); font-size: .92rem; white-space: nowrap; }
.roster-row-controls {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  margin-top: .7rem;
}
.roster-row-controls label { flex: 1; margin: 0; }
.roster-row-controls select { width: 100%; margin-top: .3rem; background: var(--bg); }
.remove-unit { flex: none; margin-bottom: 1px; }

.roster-addons {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-top: .7rem;
  padding-top: .6rem;
  border-top: 1px solid var(--line);
}
.roster-addons label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .45rem;
  color: var(--text-dim);
  font-size: .74rem;
  cursor: pointer;
}
.roster-addons strong { color: var(--text); font-weight: 600; }
.roster-wargear {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-top: .7rem;
  padding-top: .6rem;
  border-top: 1px solid var(--line);
}
.roster-wargear label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  color: var(--text-dim);
  font-size: .74rem;
}
.roster-wargear small {
  display: block;
  color: var(--text-faint);
  font-size: .65rem;
}
.roster-wargear input {
  width: 4rem;
  padding: .35rem .45rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  text-align: center;
}
.roster-wargear input:focus { outline: 0; border-color: var(--focus); }
.roster-recipe { display: inline-block; margin-top: .55rem; }

.points-source-note {
  margin-top: 1rem;
  padding: .85rem 1rem;
  color: var(--text-faint);
  font-size: .75rem;
}
.points-source-note strong { color: var(--text-dim); }
.points-source-note p { margin: .15rem 0; }
.points-source-note a { color: var(--text-dim); }

@media (max-width: 900px) {
  .army-toolbar { align-items: stretch; flex-direction: column; }
  .army-controls { justify-content: space-between; }
  .army-summary { grid-template-columns: 1fr auto; }
  .army-summary-actions { grid-column: 1 / -1; }
  .copy-status { width: auto; text-align: left; }
  .army-grid { grid-template-columns: 1fr; }
  .army-catalogue-panel { height: clamp(28rem, 65vh, 38rem); }
}

@media (max-width: 600px) {
  .army-page { padding-inline: .8rem; }
  .army-page .accountbar { align-items: flex-start; }
  .army-page .navlinks { gap: .75rem; }
  .army-page .navlinks a { font-size: .78rem; }
  .points-version { display: none; }
  .army-masthead { padding: 2rem 0 1.4rem; }
  .army-toolbar,
  .army-catalogue-panel,
  .army-roster-panel { padding: 1rem; }
  .army-controls { align-items: stretch; flex-direction: column; }
  .army-field select { width: 100%; min-width: 0; }
  .target-toggle button { flex: 1; }
  .template-card-actions { align-items: stretch; flex-direction: column; }
  .template-load { width: 100%; }
  .army-summary { grid-template-columns: 1fr; gap: 1rem; }
  .army-stats { justify-content: space-between; }
  .army-summary-actions { grid-column: auto; }
  .army-summary-actions button { flex: 1; }
  .roster-row-controls { align-items: stretch; flex-direction: column; }
  .remove-unit { align-self: flex-end; }
  .army-metadata { grid-template-columns:1fr; }
  .army-checks.clear { align-items:flex-start; flex-direction:column; gap:.2rem; }
  .army-checks li { grid-template-columns:1fr; gap:.1rem; }
  .unit-card-status { align-items: flex-end; }
  .unit-card-head { gap: .5rem; }
}

/* ---- footer ---- */

footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: .82rem;
  text-align: center;
}

footer p { margin: .35rem 0; }

@media (max-width: 520px) {
  .step { grid-template-columns: 4.6rem auto 1fr; gap: .55rem; }
  .masthead { padding-top: 3rem; }
}
