:root {
  --bg: #111827;
  --panel: #1f2937;
  --panel-2: #2a3647;
  --line: #374151;
  --text: #ffffff;
  --muted: #9ca3af;
  --gold: #facc15;
  --olive: #64748b;
  --ok: #4ade80;
  --warn: #facc15;
  --bad: #f87171;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --bgimg: url(/img/multicam.svg); /* the page backdrop: camo everywhere, deep space on the Bounties tab (body.theme-space) */
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
  background-image: radial-gradient(circle at 20% -10%, #1e293b 0, transparent 45%);
  min-height: 100vh;
}
/* MultiCam backdrop: a fixed layer (js/parallax.js drifts it at 20% of the scroll speed) under a dark wash so text stays readable. */
#bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--bgimg) 0 0 / 800px 800px repeat; }
body.theme-space { --bgimg: url(/img/space.svg); }
body.theme-space #bg::after { background: linear-gradient(rgba(4, 5, 13, .18), rgba(4, 5, 13, .34)); } /* a lighter wash than the camo gets, so the stars read */
#bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(17,24,39,.58), rgba(17,24,39,.72)); }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; letter-spacing: .01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.15rem; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
h3 { font-size: 1.05rem; } h4 { margin-top: 1.1rem; }
.h1-sub { font-size: .9rem; font-weight: 400; margin-left: .5rem; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .nowrap { white-space: nowrap; } .prewrap { white-space: pre-wrap; }
.spacer { flex: 1; }
code { background: var(--panel-2); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem; background: rgba(31, 41, 55, .95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { white-space: nowrap; display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.1rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); }
.tabs { display: flex; gap: .25rem; margin-left: 1rem; flex: 1; }
.tab { white-space: nowrap; padding: .5rem .9rem; border-radius: 8px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.tab:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.tab.active { color: #fff; background: #374151; }
.tab[data-tab="bounties"]:hover { color: #fff; background: #b91c1c; }
.tab[data-tab="bounties"].active { color: #fff; background: #991b1b; box-shadow: 0 0 12px rgba(239, 68, 68, .45); }
.tab[data-tab="admin"] { color: var(--gold); }
.tab[data-tab="admin"].active { color: var(--gold); }
.me { display: flex; align-items: center; gap: .5rem; }
.me-chip { display: flex; align-items: center; gap: .5rem; padding: .25rem .7rem .25rem .3rem; border: 1px solid var(--line); border-radius: 999px; color: var(--text); }
.me-chip:hover { text-decoration: none; border-color: var(--gold); }
.me-chip.active { border-color: var(--gold); background: var(--panel); }
.view {
  max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; min-height: calc(100vh - 4rem);
  /* a dark backing under all page content so text that isn't inside a box stays readable over the camo */
  background: rgba(17, 24, 39, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  border-left: 1px solid rgba(55, 65, 81, .7); border-right: 1px solid rgba(55, 65, 81, .7);
}

/* ---------- generic ---------- */
.page-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; flex: 1; }
.card, .card-flat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card-flat { padding: .6rem 1rem; }
.loading, .empty { padding: 2.5rem; text-align: center; color: var(--muted); }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } .grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 1rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .35rem 0; }
.notice { background: var(--panel-2); border-left: 3px solid var(--olive); padding: .6rem .9rem; border-radius: 6px; margin: 0 0 1rem; font-size: .9rem; }
.notice.warn { border-color: var(--warn); } .notice.ok { border-color: var(--ok); } .notice.bad { border-color: var(--bad); color: #ffb4b4; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; font: inherit; font-weight: 600; font-size: .9rem;
  padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}
.btn:hover { border-color: var(--gold); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: #111827; border-color: var(--gold); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: #ffb4b4; border-color: #5a2a2a; background: #2a1717; }
.btn-danger:hover { border-color: var(--bad); }
.btn-ghost { background: transparent; }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }
.btn-steam { background: linear-gradient(#2a475e, #1b2838); border-color: #66c0f4; color: #fff; padding: .75rem 1.6rem; font-size: 1.05rem; }
.btn-steam:hover { border-color: #fff; }
.tab-discord { margin-left: auto; background: #5865f2; color: #fff; border: 1px solid #5865f2; }
.tab-discord:hover { background: #6d79f5; color: #fff; text-decoration: none; }
.tab-discord.is-disabled { background: transparent; color: var(--muted); border: 1px dashed var(--line); cursor: not-allowed; }
.tab-discord.is-disabled:hover { background: transparent; color: var(--muted); }
.btn.tab-discord { padding: .45rem 1rem; }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: .25rem .4rem; border-radius: 6px; }
.icon-btn:hover:not(:disabled) { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger:hover { color: var(--bad); }

input, select, textarea {
  font: inherit; color: var(--text); background: #0f172a; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; min-width: 0; max-width: 100%;
}
input[type=color] { padding: .15rem; height: 2.3rem; width: 100%; cursor: pointer; }
input[type=checkbox] { accent-color: var(--gold); width: 1rem; height: 1rem; padding: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; }
textarea { width: 100%; resize: vertical; }

.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .03em; color: #fff; background: var(--pill, var(--olive)); }
.pill-type { --pill: #374151; color: var(--text); text-transform: uppercase; font-size: .66rem; vertical-align: middle; }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 6px; font-size: .72rem; font-weight: 700; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); margin-left: .25rem; text-transform: uppercase; letter-spacing: .04em; }
.badge-ok { color: var(--ok); border-color: #1f5a30; background: #13261a; }
.badge-warn { color: var(--warn); border-color: #7a6a14; background: #2b2810; }
.badge-bad { color: #ff8e8e; border-color: #6a2424; background: #2a1414; }
.badge-role { color: var(--gold); border-color: #7a6a14; background: #2b2810; }

/* ---------- activity orbs ---------- */
.orb { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; vertical-align: middle; background: var(--c); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35), 0 0 9px var(--c); }
.orb-green { --c: var(--ok); } .orb-yellow { --c: var(--warn); } .orb-red { --c: var(--bad); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; font-size: .85rem; }
.legend-item { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); }

.avatar { border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; background: var(--panel-2); }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--gold); border: 1px solid var(--line); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 1rem; }
.card .table-wrap { border: 0; margin: 0; background: transparent; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .65rem .85rem; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, .15); }
.table td { padding: .55rem .85rem; border-bottom: 1px solid #2b3544; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.clickable { cursor: pointer; } .table tr.clickable:hover td { background: var(--panel-2); }
.who { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 600; }
.who:hover { text-decoration: none; color: var(--gold); }
.row-actions { text-align: right; white-space: nowrap; } .row-actions .btn + .btn { margin-left: .25rem; }

.filters { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr) 1fr 1fr 1.3fr auto; gap: .5rem; margin-bottom: 1rem; }
.filters input, .filters select { width: 100%; }
.toolbar { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.toolbar h2 { margin: 0; }
.toolbar input[type=search] { min-width: 240px; }

/* ---------- home / events ---------- */
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn { background: transparent; border: 0; color: var(--muted); padding: .4rem .9rem; border-radius: 7px; font: inherit; font-weight: 600; cursor: pointer; }
.seg-btn.on { background: var(--gold); color: #111827; }
.month { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; margin: 1.5rem 0 .6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.event { display: flex; gap: 1rem; align-items: stretch; padding: .85rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .6rem; cursor: pointer; }
.event:hover { border-color: var(--gold); background: var(--panel-2); }
.date-block { width: 64px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #0f172a; border: 1px solid var(--line); border-radius: 8px; padding: .3rem 0; }
.date-block .dow, .date-block .mon { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.date-block .day { font-size: 1.6rem; font-weight: 800; color: var(--gold); line-height: 1.1; }
.event-main { flex: 1; min-width: 0; }
.event-title { font-weight: 700; font-size: 1.05rem; }
.event-desc { margin: .35rem 0 0; color: #d1d5db; font-size: .9rem; }
.event-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: .2rem; text-align: right; }
.rsvp { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; margin-top: .3rem; }
.rsvp-box { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: .75rem 0; padding: .6rem .8rem; background: #0f172a; border: 1px solid var(--line); border-radius: 8px; }
.rsvp-box .rsvp { margin: 0; }
.btn.on-ok { background: #13261a; border-color: #1f5a30; color: var(--ok); }
.btn.on-warn { background: #2b2810; border-color: #7a6a14; color: var(--warn); }
.people { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .25rem .75rem; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .2rem 0; }
.people a { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); }
.rk { color: var(--gold); font-weight: 700; font-size: .8rem; min-width: 2.2em; display: inline-block; }

/* ---------- profile ---------- */
.profile-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 3px solid var(--gold); }
.profile-id { display: flex; gap: 1.1rem; align-items: center; }
.profile-id h1 { margin-bottom: .1rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.profile-id .avatar { border: 2px solid var(--gold); }
.rank-prefix { color: var(--gold); }
.insignia { display: inline-block; flex: none; vertical-align: middle; border-radius: 6px; overflow: hidden; line-height: 0; }
.insignia svg { display: block; }
.insignia-img { object-fit: contain; background: #0f172a; padding: 2px; }
.rank-cell { display: inline-flex; align-items: center; gap: .55rem; }
.profile-insignia { margin-left: auto; padding: 0 1rem; display: flex; align-items: center; }
.name-preview { margin: -.3rem 0 0; }
.fold + .fold { margin-top: .5rem; }
.fold .table-wrap { border: 0; margin: 0; }
.profile-actions { display: flex; gap: .5rem; align-items: flex-start; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.activity-box { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.activity-box .orb { width: 22px; height: 22px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.stat { background: #0f172a; border: 1px solid var(--line); border-radius: 8px; padding: .6rem; text-align: center; }
.stat .n { display: block; font-size: 1.5rem; font-weight: 800; color: var(--gold); } .stat .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* A rack is three ribbons wide and grows upward: the first (most senior) row sits at the bottom and further
   rows stack above it, an unfinished top row centred, like a real ribbon rack. */
.rack { display: flex; flex-wrap: wrap-reverse; align-content: flex-start; justify-content: center; gap: 0; padding: .7rem; /* see-through: the page's own camo + wash + backing, fixed to the viewport and parallaxed like #bg, so the card behind does not hide the camo */
  background: linear-gradient(rgba(17, 24, 39, .62), rgba(17, 24, 39, .62)),
    fixed linear-gradient(rgba(17, 24, 39, .58), rgba(17, 24, 39, .72)) 0 0 / 100vw 100vh no-repeat,
    fixed var(--bgimg) 0 var(--bgy, 0px) / 800px 800px repeat;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 1rem; width: calc(3 * 62px + 1.4rem + 2px); box-sizing: border-box; max-width: 100%; }
.rack .ribbon-bar { width: 62px; height: 26px; }
.ribbon-bar { display: inline-block; width: 62px; height: 26px; border-radius: 2px; flex: none; border: 1px solid rgba(0, 0, 0, .5);
  background: linear-gradient(90deg, var(--a) 0 10%, var(--c) 10% 42%, var(--a) 42% 58%, var(--c) 58% 90%, var(--a) 90% 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
.medal { display: inline-block; width: 22px; height: 22px; border-radius: 50%; flex: none; border: 3px solid var(--a); background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), inset 0 0 6px rgba(0, 0, 0, .5); }
.rack .medal { width: 24px; height: 24px; margin: 0 19px; }
.awards { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.awards li { display: flex; align-items: center; gap: .8rem; padding: .35rem .5rem; border-radius: 8px; }
.awards li:hover { background: var(--panel-2); }
.awards .medal { margin: 0 16px; }
.ribbon-img { display: inline-block; flex: none; vertical-align: middle; width: 62px; height: auto; aspect-ratio: 1048 / 448; object-fit: fill; border-radius: 2px; border: 1px solid rgba(0, 0, 0, .55); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
.rack .ribbon-img { width: 62px; }
.rack .ribbon-img, .rack .ribbon-bar { border: 0; border-radius: 0; box-shadow: none; display: block; } /* touching, no lines or gaps between ribbons */
.award-text { flex: 1; }

/* ---------- modal / forms / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(2, 6, 23, .7); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem 2rem; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; } .modal-body { padding: 1rem 1.1rem 1.2rem; }
.form { display: grid; gap: .8rem; }
.form.inline { display: flex; flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: .25rem; } .field-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; } .hint { font-size: .78rem; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; } .three { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .8rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .5rem; align-items: center; }
.check { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.preview-row { display: flex; align-items: center; gap: .6rem; color: var(--muted); }
.fold { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; } .fold summary { cursor: pointer; font-weight: 600; margin-bottom: .5rem; }
.picker-bar { display: flex; gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; } .picker-bar input { flex: 1; min-width: 160px; }
.picker-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #0f172a; display: grid; grid-template-columns: 1fr 1fr; }
.pick { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; cursor: pointer; border-bottom: 1px solid #2b3544; }
.pick:hover { background: var(--panel-2); } .pick[hidden] { display: none; }
.picker-summary { margin: .5rem 0; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: grid; gap: .5rem; }
.toast { padding: .6rem 1rem; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow); max-width: 360px; transition: opacity .4s; }
.toast-ok { border-left: 3px solid var(--ok); } .toast-err { border-left: 3px solid var(--bad); } .toast.out { opacity: 0; }

/* ---------- admin ---------- */
.subnav { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.subtab { padding: .55rem 1rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtab:hover { color: var(--text); text-decoration: none; } .subtab.active { color: var(--gold); border-color: var(--gold); }
.log-table td { vertical-align: top; } .log-table pre { margin: .3rem 0 0; max-width: 340px; overflow: auto; font-size: .75rem; background: #0f172a; padding: .5rem; border-radius: 6px; }

/* ---------- ORBAT ---------- */
.orbat-layout { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
.org-scroll { overflow: auto; padding-bottom: 1rem; }
.view:has(.page-orbat) { max-width: none; }          /* the ORBAT uses the whole window */
.view:has(.page-users) { max-width: 1612px; }        /* the Users list is 30% wider than the other pages (1240px) */
.org { display: block; width: 100%; padding: .5rem; }
.org ul { display: flex; justify-content: flex-start; width: 100%; padding: var(--vgap, 22px) 0 0; margin: 0; list-style: none; position: relative; }
.org > ul { padding-top: 0; }
/* Each unit's column grows in proportion to the number of squads beneath it, so the whole chart shares the page width. */
.org li { display: flex; flex: var(--w, 1) 1 0; flex-direction: column; align-items: center; position: relative; padding: var(--vgap, 22px) 8px 0; }
.org > ul > li { padding-top: 0; }
.org li::before, .org li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: var(--vgap, 22px); border-top: 2px solid var(--line); }
.org li::after { right: auto; left: 50%; border-left: 2px solid var(--line); }
.org > ul > li::before, .org > ul > li::after { display: none; }
.org li:only-child::before, .org li:only-child::after { display: none; }
.org li:only-child { padding-top: var(--vgap, 22px); } .org > ul > li:only-child { padding-top: 0; }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 2px solid var(--line); border-radius: 0 6px 0 0; }
.org li:first-child::after { border-radius: 6px 0 0 0; }
.org ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid var(--line); height: var(--vgap, 22px); }
.unit { flex: none; width: 100%; max-width: 260px; min-width: min-content; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 8px; padding: .5rem; position: relative; }
/* Boxes are normally 150-260px wide. A member's row (insignia, name, position and rack kept on one line) can need a little more than 260px: min-content
   beats max-width, so the box grows just enough and the row never leaks out of it. The invisible 150px strip keeps the old minimum width. */
.unit::before { content: ''; display: block; width: 150px; height: 0; }
.unit[draggable=true] { cursor: grab; }
.unit-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding: .1rem .2rem .4rem; border-bottom: 1px solid var(--line); margin-bottom: .4rem; }
.unit-head h3 { margin: 0; font-size: .95rem; flex: 1 1 8ch; min-width: 8ch; overflow-wrap: break-word; }
.unit-type { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: #111827; background: var(--olive); padding: .05rem .4rem; border-radius: 4px; font-weight: 800; }
.count { font-size: .72rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 .5rem; color: var(--muted); }
.unit-patch { display: block; width: auto; height: auto; max-width: 44px; max-height: 44px; margin: .1rem auto .45rem; object-fit: contain; border-radius: 4px; opacity: .92; pointer-events: none; }
.unit-patch-lg { max-width: 96px; max-height: 96px; margin: .4rem auto; }
.patch-editor { display: grid; gap: .6rem; }
.patch-preview { text-align: center; padding: .6rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.unit-tools { display: flex; gap: 0; justify-content: flex-end; margin: -.2rem 0 .3rem; flex-wrap: wrap; }
.unit-tools .icon-btn { font-size: .78rem; padding: .15rem .35rem; }
.roster { display: grid; gap: 3px; min-height: 24px; }
.roster-empty { font-size: .78rem; color: var(--muted); text-align: center; padding: .4rem; border: 1px dashed var(--line); border-radius: 6px; }
.member { display: flex; align-items: center; gap: .45rem; padding: .25rem .4rem; border-radius: 6px; background: #0f172a; border: 1px solid transparent; font-size: .85rem; }
.member .m-main { flex: 1; min-width: 0; color: var(--text); display: block; overflow-wrap: anywhere; }
.member a.m-main:hover { color: var(--gold); text-decoration: none; }
.member .pos { display: block; font-size: .72rem; color: var(--muted); }
.member.is-admin { cursor: grab; } .member.is-admin:hover { border-color: var(--gold); }
.root-drop { margin: 1rem auto 0; max-width: 420px; text-align: center; font-size: .82rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: .5rem; }
.dragging { opacity: .4; }
.drop-ok { outline: 2px dashed var(--gold); outline-offset: 2px; background: rgba(250, 204, 21, .08); }

/* ---------- campaign ---------- */
.head-actions { display: flex; gap: .5rem; align-items: center; }
.head-actions .btn { cursor: pointer; }
/* the campaign grid: 5 pictures across and 3 down, each a square of the game table */
.campaign-grid-wrap { overflow-x: auto; margin-bottom: .5rem; border-radius: var(--radius); }
.campaign-grid { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 3px; min-width: 760px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid-tile { position: relative; aspect-ratio: 16 / 10; background: #020617; overflow: hidden; min-width: 0; }
.grid-tile .tile-link { display: block; width: 100%; height: 100%; line-height: 0; cursor: zoom-in; }
.grid-tile .tile-link img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-empty { position: absolute; inset: 6px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: .78rem; border: 1px dashed transparent; border-radius: 6px; }
.campaign-grid.is-admin .tile-empty { border-color: #7a6a14; }
.grid-tile.is-over, .grid-tile.is-chip-over { outline: 3px dashed var(--gold); outline-offset: -4px; }
.grid-tile.is-chip-over::after { content: ''; position: absolute; inset: 0; background: rgba(242, 194, 48, .14); pointer-events: none; }
.grid-tile.is-uploading { opacity: .55; pointer-events: none; }
.tile-tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; z-index: 2; }
.grid-tile:hover .tile-tools, .grid-tile:focus-within .tile-tools { opacity: 1; }
@media (hover: none) { .tile-tools { opacity: 1; } }
.tile-tools .btn { background: rgba(15, 23, 42, .88); }
.tile-chips { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; pointer-events: none; z-index: 1; }
.chip { --cc: var(--gold); display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; padding: 2px 8px 2px 3px; border-radius: 999px; background: rgba(2, 6, 23, .82); border: 1.5px solid var(--cc); color: #f1f5f9; font-size: .72rem; font-weight: 600; line-height: 1.25; cursor: pointer; pointer-events: auto; user-select: none; }
.chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.chip[draggable="true"] { cursor: grab; }
.chip.is-dragging { opacity: .4; }
.chip-blufor { --cc: #3b82f6; } .chip-opfor { --cc: #ef4444; } .chip-pmc { --cc: #f59e0b; }
.chip-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--cc); box-shadow: 0 0 0 2px rgba(2, 6, 23, .6); flex: none; }
.chip-img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none; background: #0f172a; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12ch; }
.chip-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin: 0 0 1rem; }
.chip-key { cursor: default; pointer-events: none; padding: 2px 10px 2px 5px; }
.chip-detail .table th { text-align: left; color: var(--muted); font-weight: 600; padding-right: 1.5rem; }
.chip-counts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 560px) { .chip-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.campaign-body { font-size: 1.04rem; line-height: 1.75; max-width: 80ch; }
.campaign-body p { margin: 0 0 1rem; white-space: pre-line; overflow-wrap: anywhere; }
.campaign-text textarea { min-height: 14rem; line-height: 1.6; }
.campaign-meta { margin: .75rem 0 0; }

/* ---------- command / elections ---------- */
.pill-campaign { --pill: #6a4a14; color: #ffe39a; text-transform: uppercase; font-size: .64rem; vertical-align: middle; }
.election-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.election-head h2, .election-head h3 { margin: .25rem 0 .1rem; }
.command-slots, .offices, .ballot { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.command-slot { background: #0f172a; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 8px; padding: .9rem 1rem; }
.slot-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .5rem; }
.slot-person { display: flex; align-items: center; gap: .9rem; color: var(--text); font-size: 1.1rem; }
.slot-person:hover { text-decoration: none; color: var(--gold); }
.slot-person > span { display: flex; flex-direction: column; }
.slot-person .avatar { border: 2px solid var(--gold); }
.slot-empty { color: var(--muted); padding: .6rem 0; }
.person { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); }
.campaign-progress.due { border-color: #7a6a14; box-shadow: 0 0 0 1px rgba(242, 194, 48, .25) inset; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chip { background: #0f172a; border: 1px solid var(--line); border-radius: 999px; padding: .15rem .7rem; font-size: .82rem; }
.election-open { border-top: 3px solid var(--ok); }
.turnout { margin: .9rem 0 .6rem; }
.turnout-bar, .bar { height: 10px; background: #0f172a; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.turnout-bar span, .bar span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.turnout .muted { display: block; margin-top: .3rem; }
.ballot-card { background: #0f172a; border: 1px solid var(--line); border-radius: 8px; padding: .9rem 1rem; display: grid; gap: .6rem; align-content: start; }
.ballot-card h3 { margin: 0; }
.vote-status { margin: 0; color: var(--muted); font-size: .9rem; }
.vote-status.voted { color: var(--ok); }
.ballot-card input[type=search] { width: 100%; }
.cand-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.cand { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; cursor: pointer; border-bottom: 1px solid #2b3544; }
.cand:hover { background: var(--panel-2); } .cand[hidden] { display: none; }
.cand:has(input:checked) { background: #1b2638; box-shadow: inset 3px 0 0 var(--gold); }
.cand-unit { margin-left: auto; }
.history { margin-top: 1.5rem; }
.history .election { margin-bottom: 1rem; }
.orbat-note { margin: .9rem 0 0; padding: .6rem .9rem; background: #0f172a; border-left: 3px solid #5b8fd6; border-radius: 6px; font-size: .92rem; }
.orbat-note ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.office-result h4 { margin: .2rem 0 .6rem; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) auto; gap: .75rem; align-items: center; padding: .25rem 0; }
.bar-who { min-width: 0; overflow-wrap: anywhere; }
.bar-num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; text-align: right; min-width: 6.5em; }
.bar-row.win .bar span { background: var(--ok); }
.bar-row.win .bar-num { color: var(--ok); }
@media (max-width: 760px) {
  .command-slots, .offices, .ballot { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr auto; } .bar-row .bar { grid-column: 1 / -1; order: 3; }
}

/* ---------- skulls ---------- */
.skull-icon { display: inline-block; flex: none; vertical-align: middle; object-fit: contain; }
/* uploaded icons (e.g. the light-blue Halo skulls) sit on a dark navy tile so they stay visible on the dark theme */
img.skull-icon { background: #0f1a2b; border-radius: 5px; padding: 1px; }
.skull-default { color: #d9d2a0; }
.skull-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.skull-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .6rem .12rem .4rem; border-radius: 999px; background: #1c1812; border: 1px solid #5e4a27; color: #f0dca8; font-size: .78rem; font-weight: 600; letter-spacing: .02em; cursor: help; }
.skull-list { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .5rem; }
.skull-list li { display: flex; gap: .7rem; align-items: flex-start; }
.skull-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem; }
.skull-opt { display: flex; align-items: center; gap: .45rem; padding: .35rem .55rem; border: 1px solid var(--line); border-radius: 8px; background: #0f172a; cursor: pointer; font-size: .88rem; }
.skull-opt:hover { border-color: #5e4a27; }
.skull-opt:has(input:checked) { border-color: var(--gold); background: #262312; box-shadow: inset 3px 0 0 var(--gold); }
.skull-mini { display: inline-flex; gap: .15rem; margin-left: .4rem; vertical-align: middle; }
.icon-edit { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.icon-edit .skull-icon { border-radius: 6px; background: #0f172a; padding: 4px; }

/* ---------- help ---------- */
.help-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.help-toc { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; margin: 0; padding: .9rem 1rem; }
.help-toc input[type=search] { width: 100%; margin-bottom: .6rem; }
.toc-group h3 { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); margin: .9rem 0 .3rem; }
.toc-group ul { list-style: none; margin: 0; padding: 0; }
.toc-group li a { display: block; padding: .28rem .5rem; border-radius: 6px; color: var(--text); font-size: .9rem; }
.toc-group li a:hover { background: var(--panel-2); text-decoration: none; color: var(--gold); }
.toc-group[hidden], .toc-group li[hidden], .help-section[hidden] { display: none; }
.help-section { scroll-margin-top: 90px; }
.help-title { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.help-title h2 { margin: 0; }
.help-summary { margin: .2rem 0 1rem; }
.help-section h4 { margin: 1.2rem 0 .35rem; color: var(--text); }
.help-section p { margin: .4rem 0; line-height: 1.65; max-width: 80ch; }
.help-section ul, .help-section ol { margin: .4rem 0 .8rem; padding-left: 1.3rem; line-height: 1.6; max-width: 82ch; }
.help-section li { margin: .25rem 0; }
.help-section code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em; font-size: .88em; }
.help-section .table-wrap { margin: .6rem 0 1rem; }
.help-table td:first-child { white-space: nowrap; }
.help-table td { vertical-align: top; }
.callout { margin: .8rem 0; padding: .65rem .9rem; background: #0f172a; border-left: 3px solid var(--olive); border-radius: 6px; max-width: 82ch; line-height: 1.6; }
.callout.warn { border-left-color: var(--warn); }
@media (max-width: 900px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-toc { position: static; max-height: 14rem; }
}
.help-layout > *, .help-section { min-width: 0; }
.help-section .table-wrap { overflow-x: auto; }
.help-section li, .help-section p, .callout { overflow-wrap: anywhere; }
@media (max-width: 760px) { .help-table td:first-child { white-space: normal; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 420px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 14px; padding: 2.2rem 1.8rem; box-shadow: var(--shadow); }
.login-card h1 { font-size: 2.1rem; letter-spacing: .18em; text-transform: uppercase; margin-bottom: .2rem; }
.crest-logo { display: block; margin: 0 auto .4rem; object-fit: contain; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .55)); }
.login-welcome { margin: 1.1rem 0 0; padding: .8rem .9rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-size: .92rem; line-height: 1.5; text-align: left; }
.login-card .btn-steam { margin-top: 1.4rem; }
.login-note { margin: .8rem 0 0; }
.login-discord { margin-top: 1.1rem; }
.login-discord .tab-discord { margin-left: 0; }
.onboarding { display: grid; gap: .75rem; text-align: left; }
.onboarding h1, .onboarding > p { text-align: center; margin: 0; }
.onboarding .avatar-xl { display: flex; justify-content: center; }
.onboarding .avatar { border: 2px solid var(--gold); }
.onboarding .btn-primary { justify-content: center; padding: .65rem; font-size: 1rem; }
.onboarding .login-note { text-align: center; }
.badge-default { color: var(--gold); border-color: #7a6a14; background: #2b2810; }
.unit.is-default { border-top-color: var(--ok); }
.badge-command { color: #9ec9ff; border-color: #2f4a73; background: #14233f; }
.unit.is-command { border-top-color: #5b8fd6; }
.unit.is-default.is-command { border-top-color: #5b8fd6; box-shadow: inset 0 3px 0 var(--ok); }
.dev-box { margin-top: 1.4rem; text-align: left; } .dev-list { display: grid; gap: .35rem; }
.center-card { max-width: 480px; margin: 20vh auto; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1580px) { /* eight tabs (nine for admins) + Join Discord + the profile chip need two rows below this width */
  .topbar { flex-wrap: wrap; row-gap: .4rem; }
  .tabs { order: 3; flex: 1 1 100%; margin: 0; overflow-x: auto; }
  .me { margin-left: auto; }
}
@media (max-width: 1000px) {
  .filters { grid-template-columns: 1fr 1fr 1fr; } .filters input[type=search] { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: .5rem .75rem; gap: .5rem; }
  .tabs { order: 3; flex: 1 1 100%; margin: 0; overflow-x: auto; } .tab { padding: .4rem .75rem; white-space: nowrap; }
  .users-table td .small { display: none; }
  .me-name { display: none; } .me { margin-left: auto; }
  .view { padding: 1rem .75rem 3rem; }
  .grid-2, .two, .three { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .event { flex-wrap: wrap; } .event-side { align-items: flex-start; text-align: left; flex-direction: row; gap: .6rem; width: 100%; }
  .picker-list { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .users-table th:nth-child(n+4), .users-table td:nth-child(n+4) { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.discord-box { margin-bottom: .8rem; }
.series-box { display: grid; gap: .4rem; margin-bottom: 1rem; }
.series-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }

/* ---------- resources (modelled on Help) ---------- */
.res-actions { display: flex; align-items: center; gap: .35rem; }
.res-text h4 { margin: 1.2rem 0 .35rem; }
.res-text p { margin: .4rem 0; line-height: 1.65; max-width: 80ch; }
.res-text ul { margin: .4rem 0 .8rem; padding-left: 1.3rem; line-height: 1.6; max-width: 82ch; }
.res-text code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em; font-size: .88em; }
.res-editor textarea { width: 100%; font-family: inherit; }
.res-editor input { width: 100%; }

/* ---------- language button ---------- */
.lang-toggle { white-space: nowrap; }
.login-lang { position: fixed; top: .9rem; right: 1rem; z-index: 10; }

.log-table summary { white-space: nowrap; }

/* MOS: tags beside names, the MOS tab, and an ORBAT element's MOS requirement */
.mos-tags { display: inline-flex; flex-wrap: wrap; gap: .2rem; margin-left: .35rem; vertical-align: middle; }
.mos-tag { display: inline-block; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 .4rem; border-radius: 4px; font-size: .66rem; font-weight: 700; letter-spacing: .02em; line-height: 1.5; color: #bde0ff; background: #14233f; border: 1px solid #2f4a73; vertical-align: middle; }
.mos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1rem; }
.mos-grid > .card { margin-bottom: 0; }
.mos-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.mos-head h2 { margin: 0; }
.mos-sub { margin: .9rem 0 .25rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mos-members { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.mos-pick { display: grid; gap: .1rem; max-height: 50vh; overflow: auto; margin: .6rem 0; padding: .3rem; border: 1px solid var(--line); border-radius: 6px; }
.mos-pick .check[hidden] { display: none; }
.mos-pick .check.muted { opacity: .55; }
.check-open-book { margin: .4rem 0 .6rem; padding: .4rem .6rem; border-left: 3px solid var(--gold); background: rgba(250, 204, 21, .06); font-size: .85rem; }
.pill-wait { --pill: #854d0e; }
.screening-list { max-height: 55vh; } .screen-row { display: flex; gap: .5rem; align-items: center; text-align: left; width: 100%; background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 6px; padding: .3rem .5rem; font: inherit; cursor: pointer; } .screen-row:hover { background: var(--panel-2); } .screen-row.on { border-color: var(--ok); color: var(--ok); background: rgba(34, 197, 94, .08); }
.approvals { margin-bottom: 1rem; border-left: 3px solid var(--gold); } .approval-list { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .35rem; } .approval-list li { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.retake-status { margin: .5rem 0 0; padding: .4rem .6rem; border-left: 3px solid var(--gold); } .retake-status p { margin: 0 0 .25rem; }
.mos-prereqs { list-style: none; margin: .3rem 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.mos-prereqs li { padding: .1rem .6rem; border-radius: 999px; border: 1px solid var(--line); font-size: .82rem; background: var(--panel-2); }
.mos-prereqs li.held { border-color: var(--ok); color: var(--ok); } .mos-prereqs li.missing { border-color: var(--warn); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.unit-req { text-align: center; font-size: .72rem; color: var(--muted); margin: 0 0 .4rem; }
.member.lacks-mos { border-color: #7a6a14; }
.member.lacks-mos::after { content: '⚠'; color: var(--warn); font-size: .8rem; }
.radio-list { display: grid; gap: .35rem; margin: .5rem 0; }
.card.narrow { max-width: 34rem; }

/* Users list: keep each cell on one line (no "Command / Staff", "Oct 31, / 2026"); only the MOS cell may wrap */
.users-table td, .users-table th { white-space: nowrap; padding-left: .65rem; padding-right: .65rem; }
.users-table td.mos-cell { white-space: normal; min-width: 14rem; }
.users-table .mos-tags { margin-left: 0; flex-wrap: wrap; align-items: center; }
.users-table .mos-tag { max-width: 10rem; }
.mos-more { cursor: pointer; font: inherit; font-size: .66rem; font-weight: 700; line-height: 1.5; padding: 0 .4rem; border-radius: 4px; color: var(--gold); background: var(--panel-2); border: 1px solid var(--line); }
.mos-more::after { content: ' ▾'; }
.mos-more[aria-expanded="true"]::after { content: ' ▴'; }
.mos-more:hover { border-color: var(--gold); }
.mos-pop { position: fixed; z-index: 60; display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; max-width: 18rem; padding: .45rem; background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--gold); border-radius: 8px; box-shadow: var(--shadow); }
.mos-pop .mos-tag { max-width: 16rem; }
/* MOS page: the member list is a drop-down */
.mos-details { margin-top: .9rem; }
.mos-details summary { cursor: pointer; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mos-details summary:hover { color: var(--gold); }
.mos-details .mos-members { margin-top: .5rem; }

/* MOS pictures stay small so the name and text are always fully readable */
.mos-icon { flex: none; width: 40px; height: 40px; object-fit: contain; border-radius: 6px; }
.mos-icon-lg { width: 96px; height: 96px; }
.mos-head h2 { flex: 1; min-width: 0; }

/* MOS page: every entry is a drop-down; only the picture, name and member count show until it is opened */
.mos-grid { align-items: start; }
.mos-card { padding: 0; }
.mos-card > summary { list-style: none; cursor: pointer; padding: .8rem 1.1rem; }
.mos-card > summary::-webkit-details-marker { display: none; }
.mos-card > summary::after { content: '▸'; color: var(--muted); }
.mos-card[open] > summary::after { content: '▾'; }
.mos-card > summary:hover h2 { color: #fff; }
.mos-card .mos-body { padding: 0 1.1rem 1rem; border-top: 1px solid var(--line); }
.mos-card .mos-body > p:first-child { margin-top: .8rem; }
.mos-card .form-actions { flex-wrap: wrap; } /* the admin buttons wrap onto a second line instead of running out of the card */
/* A default-for-new-members MOS: a tiny star at the end of the name (it flows with the text, so it can never squeeze or cover the name),
   and a small star-only toggle for admins. */
.mos-default { margin-left: .3rem; font-size: .8em; color: var(--gold); vertical-align: .05em; }
.mos-default-btn { color: var(--gold); padding: .2rem .45rem; }

/* The small ribbon rack in the Users list: same three-wide, grows-upward layout as the profile rack, but the ribbons touch
   and the box has a fixed size (six rows at most), with no vertical padding in its cell, so a row never gets taller. */
.users-table td.rack-cell { padding-top: 0; padding-bottom: 0; }
.rack-sm { display: flex; flex-wrap: wrap-reverse; align-content: center; justify-content: center; gap: 0; width: 48px; height: 41px; overflow: hidden; }
.rack-sm .ribbon-img, .rack-sm .ribbon-bar { display: block; width: 16px; height: auto; aspect-ratio: 1048 / 448; border: 0; border-radius: 0; box-shadow: none; margin: 0; }
.rack-sm .medal { display: none; }

/* The same small rack beside a name on the ORBAT. Fixed at three rows (nine ribbons) and shorter than the insignia beside it, so a member's row is
   never taller (its top and bottom edges sit in the row's own padding). The names already fill the narrow columns, so the name and the position
   under it each stay on one line and the column grows just wide enough for the rack. The rack ignores the mouse so dragging a member by
   their ribbons still picks up the member. */
.rack-sm.rack-orbat { flex: none; margin: -3px 0; width: 48px; height: 20.6px; pointer-events: none; }
.member.has-rack .m-main { white-space: nowrap; }

/* Centre the whole rack column: the heading, the rack box in its cell, and (already) the ribbons inside the box */
.users-table th.rack-col, .users-table td.rack-cell { text-align: center; }
.rack-sm { margin: 0 auto; }


/* ---------- Bounties: the United Mining Colonies Secessionist Union's board ---------- */
/* a lighter, unblurred backing than on the camo pages, so the stars show through behind the list */
body.theme-space .view { border-left-color: rgba(127, 29, 29, .55); border-right-color: rgba(127, 29, 29, .55); background: rgba(4, 5, 13, .38); -webkit-backdrop-filter: none; backdrop-filter: none; }
.pill-zeus { --pill: #4c1d95; color: #ddd6fe; text-transform: uppercase; font-size: .64rem; vertical-align: middle; }
.pill-bounty { --pill: #7f1d1d; color: #fecaca; text-transform: uppercase; font-size: .64rem; vertical-align: middle; }
.bm-hero { display: flex; align-items: center; gap: 1.6rem; padding: 1.2rem 1.6rem; margin-bottom: 1.1rem; position: relative; overflow: hidden;
  background: linear-gradient(100deg, rgba(60, 8, 12, .85), rgba(10, 6, 9, .9) 55%), rgba(8, 5, 8, .9);
  border: 1px solid #5b1519; border-left: 4px solid #b91c1c; border-radius: 4px; box-shadow: 0 0 34px rgba(185, 28, 28, .22); }
.bm-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 4px); }
.bm-logo { width: 190px; height: 190px; flex: none; filter: drop-shadow(0 0 18px rgba(220, 38, 38, .55)); }
.bm-hero-text { position: relative; z-index: 1; min-width: 0; }
.bm-kicker { color: #f87171; text-transform: uppercase; letter-spacing: .32em; font-size: .78rem; font-weight: 800; }
.bm-hero h1 { margin: 0; font-size: 1.7rem; letter-spacing: .16em; line-height: 1.15; text-transform: uppercase; color: #f87171; text-shadow: 0 0 18px rgba(239, 68, 68, .45); }
.bm-market { margin: 0 0 .6rem; font-size: 2.7rem; font-weight: 800; letter-spacing: .14em; line-height: 1.1; text-transform: uppercase; text-shadow: 0 0 22px rgba(239, 68, 68, .55); }
.bm-hero p { margin: 0 0 .7rem; max-width: 62ch; color: #e5e7eb; }
.bm-total { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; }
.bm-total strong { display: block; color: var(--gold); font-size: 1.35rem; letter-spacing: .04em; text-shadow: 0 0 12px rgba(250, 204, 21, .35); }
.bm-table { border: 1px solid #5b1519; border-radius: 4px; background: rgba(8, 5, 8, .88); overflow: hidden; }
.bm-head, .bm-row { display: grid; grid-template-columns: 3rem minmax(0, 1.7fr) minmax(0, 1fr) 72px minmax(9rem, 1fr); align-items: center; gap: .9rem; padding: .55rem 1rem; }
.bm-head { font-size: .7rem; text-transform: uppercase; letter-spacing: .16em; color: #f87171; background: rgba(127, 29, 29, .28); border-bottom: 1px solid #5b1519; }
.bm-row { position: relative; min-height: 62px; border-bottom: 1px solid rgba(91, 21, 25, .55); cursor: pointer; }
.bm-row:last-child { border-bottom: 0; }
.bm-row:hover { background: rgba(127, 29, 29, .2); }
.bm-place { font-size: 1.3rem; font-weight: 800; color: #6b7280; font-variant-numeric: tabular-nums; text-align: center; }
.bm-who { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; min-width: 0; }
.bm-name { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; min-width: 0; }
.bm-name:hover { text-decoration: none; color: #fecaca; }
.bm-name-text { overflow-wrap: anywhere; }
.bm-unit { color: #d1d5db; font-size: .9rem; overflow-wrap: anywhere; }
.bm-rack .rack-sm { margin: 0; }
.bm-bounty { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; text-align: right; }
.bm-amount { color: var(--gold); font-weight: 800; font-size: 1.12rem; font-variant-numeric: tabular-nums; text-shadow: 0 0 10px rgba(250, 204, 21, .25); white-space: nowrap; }
.bm-row.clean .bm-amount { color: #6b7280; text-shadow: none; font-weight: 600; }
.bm-edit { color: #f87171; }
.bm-stamp { display: inline-block; transform: rotate(-3deg); border: 2px solid #ef4444; color: #ef4444; padding: .02rem .5rem; font-weight: 900; font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; background: rgba(0, 0, 0, .4); text-shadow: 0 0 8px rgba(239, 68, 68, .6); white-space: nowrap; }
/* the three biggest bounties: a red wash (the biggest is also stamped MOST WANTED) */
.bm-row.wanted { background: linear-gradient(90deg, rgba(127, 29, 29, .5), rgba(54, 8, 12, .38) 70%); box-shadow: inset 0 0 44px rgba(138, 15, 20, .35); }
.bm-row.wanted:hover { background: linear-gradient(90deg, rgba(153, 27, 27, .56), rgba(70, 10, 15, .44) 70%); }
.bm-row.wanted-1 { background: linear-gradient(90deg, rgba(153, 27, 27, .62), rgba(70, 10, 15, .45) 70%); box-shadow: inset 0 0 60px rgba(160, 15, 22, .5); }
.bm-row.wanted .bm-place { color: #ef4444; text-shadow: 0 0 10px rgba(239, 68, 68, .6); }
/* the game feed panel and the kill/death line under a unit on the board */
.bm-game { margin-bottom: 1rem; } .bm-game h3 { margin: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: .5rem; }
@media (max-width: 760px) { .grid-3 { grid-template-columns: 1fr; } }
.bm-stats { color: #9ca3af; font-size: .72rem; margin-top: .15rem; }
/* the Kill Count sub tab */
.kc-head, .kc-row { display: grid; grid-template-columns: 3rem minmax(0, 1.8fr) minmax(0, 1fr) repeat(4, minmax(4.2rem, .45fr)); align-items: center; gap: .8rem; padding: .5rem 1rem; }
.kc-head { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: #f87171; background: rgba(127, 29, 29, .28); border-bottom: 1px solid #5b1519; }
.kc-row { min-height: 54px; border-bottom: 1px solid rgba(91, 21, 25, .55); cursor: pointer; } .kc-row:last-child { border-bottom: 0; } .kc-row:hover { background: rgba(127, 29, 29, .2); }
.kc-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.kc-total { color: var(--gold); font-size: 1.1rem; } .kc-deaths { color: #fca5a5; }
.kc-row.clean .kc-num { color: #6b7280; font-weight: 600; }
@media (max-width: 760px) {
  .kc-head { display: none; }
  .kc-row { grid-template-columns: 2.2rem repeat(4, 1fr); grid-template-areas: "place who who who who" ". unit unit unit unit" ". a b c d"; row-gap: .25rem; }
  .kc-row .bm-place { grid-area: place; } .kc-row .bm-who { grid-area: who; } .kc-row .bm-unit { grid-area: unit; }
  .kc-num { text-align: left; } .kc-num::before { content: attr(data-label); display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
  .kc-umc { grid-area: a; } .kc-pmc { grid-area: b; } .kc-total { grid-area: c; } .kc-deaths { grid-area: d; }
}
/* the PMC Companies sub tab */
.bm-subnav { border-bottom-color: #5b1519; }
.bm-subnav .subtab:hover, .bm-subnav .subtab.active { color: #fecaca; border-color: #ef4444; }
.bm-lead { max-width: 70ch; color: #d1d5db; margin: 0 0 .9rem; }
.pmc-summary { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .6rem 1rem; margin-bottom: 1rem; border: 1px solid #5b1519; border-radius: 4px; background: rgba(8, 5, 8, .88); }
.pmc-summary > strong { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: #f87171; }
.pmc-sum { display: inline-flex; align-items: center; gap: .35rem; } .pmc-sum b { font-size: 1.1rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.pmc-list { display: grid; gap: 1rem; }
.pmc-card { border: 1px solid #5b1519; border-radius: 4px; background: rgba(8, 5, 8, .88); padding: .9rem 1rem 1rem; }
.pmc-card.active { border-color: #ef4444; background: linear-gradient(90deg, rgba(127, 29, 29, .42), rgba(8, 5, 8, .9) 70%); box-shadow: 0 0 22px rgba(185, 28, 28, .35); }
.pmc-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .7rem; }
.pmc-head h3 { margin: 0; font-size: 1.15rem; flex: 1 1 14rem; overflow-wrap: anywhere; }
.pmc-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: rgba(255, 255, 255, .06); padding: 3px; flex: none; }
.pmc-icon-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.pmc-icon-prev { width: 64px; height: 64px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.pmc-icon-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pmc-state { text-transform: uppercase; letter-spacing: .16em; font-size: .7rem; font-weight: 800; padding: .12rem .6rem; border: 1px solid #4b5563; color: #9ca3af; border-radius: 3px; }
.pmc-card.active .pmc-state { border-color: #ef4444; color: #fecaca; background: rgba(185, 28, 28, .45); }
.pmc-assets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.pmc-asset { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem .3rem; border-radius: 4px; background: rgba(255, 255, 255, .05); text-align: center; }
.pmc-asset strong { font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pmc-asset span { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.pmc-asset.none { opacity: .45; }
.pmc-reqs { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.pmc-req-top { display: flex; justify-content: space-between; gap: .6rem; font-size: .85rem; margin-bottom: .3rem; } .pmc-req-top strong { color: var(--gold); white-space: nowrap; }
.pmc-meter { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-bottom: .25rem; }
.pmc-meter span { display: block; height: 100%; background: linear-gradient(90deg, #7f1d1d, #ef4444); }
.pmc-req.met .pmc-meter span { background: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, .7); }
.met-text { color: #fca5a5; }
@media (max-width: 760px) {
  .pmc-assets { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pmc-reqs { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .bm-hero { flex-direction: column; text-align: center; padding: 1rem; }
  .bm-logo { width: 150px; height: 150px; }
  .bm-hero h1 { font-size: 1.15rem; } .bm-market { font-size: 2rem; }
  .bm-head { display: none; }
  .bm-row { grid-template-columns: 2.2rem minmax(0, 1fr) auto; grid-template-areas: "place who who" ". unit rack" ". bounty bounty"; row-gap: .3rem; }
  .bm-rack { justify-self: end; } .bm-bounty { justify-content: flex-end; border-top: 1px solid rgba(91, 21, 25, .5); padding-top: .3rem; }
  .bm-place { grid-area: place; } .bm-who { grid-area: who; } .bm-bounty { grid-area: bounty; } .bm-unit { grid-area: unit; } .bm-rack { grid-area: rack; }
}

/* ---------- the public ORBAT page (orbat-view.html): the chart only, filling the whole window on the camo at full strength ---------- */
body.orbat-public { margin: 0; overflow: hidden; }
body.orbat-public #bg::after { display: none; } /* no dark wash: the camo shows at full opacity */
.public-stage { position: fixed; inset: 8px; overflow: hidden; }
.public-stage .org { transform-origin: 0 0; padding: 0; width: auto; }
.public-stage .org > ul > li > .unit { max-width: none; } /* only the top element (the company) spans its whole column; every other box keeps its normal ORBAT size */
.public-stage .org li { padding-left: 4px; padding-right: 4px; }
/* connectors in a light colour so they read over the camo */
.public-stage .org li::before, .public-stage .org li::after, .public-stage .org ul ul::before { border-color: #f1f5f9; }
.public-gone { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--panel); max-width: 28rem; }

.public-link { display: grid; gap: .4rem; } .public-link p { margin: 0; }
.public-link .row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.public-link input { flex: 1 1 22rem; min-width: 0; }

/* ---------- campaign status meters (under the campaign picture) ---------- */
.campaign-meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.meter { --mc: var(--gold); background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--mc); border-radius: var(--radius); padding: .8rem 1rem .9rem; }
.meter-highcom_trust { --mc: #60a5fa; } .meter-insurrection_awareness { --mc: #ef4444; } .meter-civilian_relation { --mc: #4ade80; }
.meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .55rem; }
.meter-name { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.meter-value strong { font-size: 1.6rem; color: var(--mc); line-height: 1; }
.meter-pips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.pip { display: block; height: 14px; padding: 0; border: 0; border-radius: 3px; background: #0f172a; box-shadow: inset 0 0 0 1px var(--line); }
.pip.on { background: var(--mc); box-shadow: 0 0 8px color-mix(in srgb, var(--mc) 55%, transparent); }
button.pip { cursor: pointer; } button.pip:hover { outline: 2px solid color-mix(in srgb, var(--mc) 70%, #fff); outline-offset: 1px; }
@media (max-width: 760px) { .campaign-meters { grid-template-columns: 1fr; gap: .6rem; } }

/* ---------- MOS knowledge checks ---------- */
.mos-check { background: rgba(15, 23, 42, .55); border: 1px solid var(--line); border-radius: 8px; padding: .75rem .95rem; }
.mos-check p { margin: 0 0 .5rem; }
.mos-check .form-actions { margin-top: .6rem; }
.check-admin { border-top: 1px dashed var(--line); padding-top: .55rem; align-items: center; }
.check-note.ok { color: var(--ok); font-weight: 600; margin: 0; }
.check-note.fail { border-left: 3px solid var(--warn); padding-left: .75rem; }
.check-note.fail p { margin: 0 0 .4rem; } .check-note.fail p:last-child { margin: 0; }
.quiz-q { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .8rem .7rem; margin: 0 0 .8rem; min-width: 0; }
.quiz-q legend { padding: 0 .4rem; font-weight: 700; max-width: 100%; overflow-wrap: anywhere; }
.quiz-opt { display: flex; align-items: flex-start; gap: .55rem; padding: .38rem .55rem; border-radius: 6px; cursor: pointer; }
.quiz-opt:hover { background: var(--panel-2); }
.quiz-opt:has(input:checked) { background: rgba(250, 204, 21, .13); box-shadow: inset 0 0 0 1px rgba(250, 204, 21, .45); }
.quiz-opt input { margin-top: .28rem; flex: none; } .quiz-opt span { overflow-wrap: anywhere; }
.quiz-result { text-align: center; padding: .4rem 0 .2rem; }
.quiz-result .quiz-big { width: 3.4rem; height: 3.4rem; margin: 0 auto .5rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.9rem; font-weight: 800; }
.quiz-result.pass .quiz-big { background: rgba(74, 222, 128, .15); color: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.quiz-result.fail .quiz-big { background: rgba(248, 113, 113, .13); color: var(--bad); box-shadow: 0 0 0 2px var(--bad); }
.quiz-result .recommend { text-align: left; margin: 1rem 0 .4rem; }
.quiz-result .form-actions { justify-content: center; }
.qe-q { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem .75rem; margin: 0 0 .8rem; background: rgba(15, 23, 42, .4); }
.qe-head { display: flex; align-items: center; margin-bottom: .3rem; }
.qe-q textarea { width: 100%; margin-bottom: .4rem; }
.qe-opt { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.qe-opt input[type=text] { flex: 1; min-width: 0; }
.pill-pass { --pill: #166534; } .pill-fail { --pill: #991b1b; }
.res-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- after action reports (Campaign tab, under the briefing) ---------- */
.campaign-reports h2 { margin: 1.4rem 0 .7rem; }
.aar { border-left: 3px solid var(--gold); }
.aar .toolbar { align-items: baseline; gap: .7rem; } .aar h3 { margin: 0; }

/* ---------- the comms card (inside the top ORBAT element, under its roster) and the frequency tags on the elements ---------- */
.comms { margin-top: .45rem; padding: .4rem .45rem .5rem; background: #0b1220; border: 1px solid var(--line); border-radius: 6px; text-align: left; }
.comms-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.comms-head h2 { margin: 0; font-size: .68rem; letter-spacing: .12em; }
.comms-head .btn { padding: .1rem .5rem; font-size: .7rem; }
.comms-body { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.comms-freqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(6rem, calc((100% - .7rem) / 3)), 1fr)); gap: .35rem; } /* as many blocks as fit, never more than 3 across */
.comms-freq { position: relative; padding: .3rem .45rem .35rem; border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line)); border-left: 4px solid var(--c); border-radius: 6px; background: color-mix(in srgb, var(--c) 10%, #0b1220); min-width: 0; }
.comms-freq[draggable=true] { cursor: grab; }
.comms-freq.dragging { opacity: .4; }
.comms-freq.drop-before::before, .comms-freq.drop-after::before { content: ''; position: absolute; top: -2px; bottom: -2px; width: 3px; border-radius: 2px; background: var(--gold); }
.comms-freq.drop-before::before { left: -5px; } .comms-freq.drop-after::before { right: -5px; }
.unit.has-comms { max-width: 520px; } /* wide enough for three blocks across */
.public-stage .comms { max-width: 34rem; margin-left: auto; margin-right: auto; }
.cf-name { font: 800 .95rem/1.15 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; color: var(--c); overflow-wrap: anywhere; }
.cf-desc { margin-top: .1rem; font-size: .7rem; line-height: 1.3; color: #e5e7eb; overflow-wrap: anywhere; }
.cf-units { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .3rem; }
.cf-unit { font-size: .6rem; padding: 0 .35rem; border-radius: 999px; color: #e5e7eb; background: color-mix(in srgb, var(--c) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); max-width: 100%; overflow-wrap: anywhere; }
.comms-calls { display: grid; gap: .3rem; padding-top: .35rem; border-top: 1px dashed var(--line); }
.comms-sub { font-size: .58rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.comms-call { padding: .3rem .45rem; border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line)); border-left: 4px solid var(--c); border-radius: 6px; background: color-mix(in srgb, var(--c) 10%, #0b1220); display: grid; gap: .1rem; }
.cc-name { font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--c); font-size: .72rem; }
.cc-text { color: #e5e7eb; font-size: .7rem; line-height: 1.3; overflow-wrap: anywhere; }
.freq-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: .15rem; margin: .2rem 0 .3rem; contain: inline-size; } /* contain: the tiny text never makes the element box wider */
.freq-tag { display: inline-flex; flex-direction: column; align-items: center; max-width: 100%; min-width: 0; padding: 0 .4rem .05rem; border-radius: 8px; color: var(--c); border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap; overflow: hidden; text-align: center; }
.freq-tag b { flex: none; font: 700 .6rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; }
.ft-desc { max-width: 100%; overflow: hidden; text-overflow: ellipsis; text-align: center; font-size: .5rem; line-height: 1.2; color: #cbd5e1; }
/* the editor */
.comms-edit section { display: grid; gap: .5rem; margin-bottom: 1.1rem; }
.comms-edit h4 { margin: 0; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; font-size: .82rem; }
.comms-edit .hint { margin: 0; }
.comms-edit > section > .btn { justify-self: start; }
.ce-item { display: grid; gap: .4rem; padding: .55rem .65rem; border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 8px; background: var(--panel-2, #111827); }
.ce-main { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.ce-main .ce-name { flex: 0 1 8rem; min-width: 5rem; font-weight: 700; }
.ce-main .ce-desc { flex: 1 1 14rem; min-width: 0; }
.ce-tools { display: inline-flex; margin-left: auto; }
.ce-short { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .75rem; color: var(--muted); } .ce-short input { flex: 0 1 16rem; min-width: 8rem; }
.ce-swatches { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.ce-sw { width: 1.35rem; height: 1.35rem; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid transparent; cursor: pointer; }
.ce-sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c); }
.ce-swatches input[type=color] { width: 1.9rem; height: 1.5rem; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; }
.ce-units { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.ce-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; padding: .05rem .2rem .05rem .55rem; border-radius: 999px; color: #e5e7eb; background: color-mix(in srgb, var(--c) 20%, transparent); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); }
.ce-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .25rem; } .ce-chip button:hover { color: #fff; }
.ce-units select { width: auto; max-width: 100%; }

/* ---------- IG (Inspector General) ---------- */
.ig-who { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ig-name { color: var(--gold); }
.ig-assign { display: flex; gap: .5rem; align-items: center; } .ig-assign select { max-width: 18rem; }
.ig-blurb { margin: 0 0 1rem; line-height: 1.55; max-width: 75ch; }
.ig-item { border-left: 3px solid var(--gold); } .ig-item.is-reviewed { opacity: .65; border-left-color: var(--line); }
.ig-item .toolbar { align-items: baseline; gap: .7rem; margin-bottom: .3rem; } .ig-item p { margin: 0; overflow-wrap: anywhere; }

/* ---------- service timeline (member profile) ---------- */
.timeline { list-style: none; margin: 0 0 .6rem; padding: 0 0 0 .2rem; position: relative; }
.timeline::before { content: ''; position: absolute; left: 1.02rem; top: .6rem; bottom: .6rem; width: 2px; background: var(--line); }
.timeline li { display: flex; gap: .8rem; align-items: flex-start; padding: .3rem 0; position: relative; }
.timeline li[hidden] { display: none; }
.tl-mark { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; background: #0f172a; border: 2px solid var(--line); color: var(--muted); z-index: 1; }
.tl-promotion .tl-mark { color: #4ade80; border-color: #166534; } .tl-rank .tl-mark, .tl-branch .tl-mark { color: #60a5fa; border-color: #1e3a8a; }
.tl-mos_added .tl-mark { color: #60a5fa; border-color: #1e3a8a; } .tl-mos_removed .tl-mark, .tl-retired .tl-mark { color: #f87171; border-color: #7f1d1d; }
.tl-ribbon .tl-mark, .tl-position .tl-mark { color: var(--gold); border-color: #7a6a14; } .tl-campaign_op .tl-mark { color: #fb923c; border-color: #7c2d12; }

/* ---------- IG nudge: the count on the tab and the "New" flag ---------- */
.tab-badge { display: inline-block; margin-left: .4rem; min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px; background: #ef4444; color: #fff; font-size: .68rem; font-weight: 800; line-height: 1.35; text-align: center; box-shadow: 0 0 8px rgba(239, 68, 68, .55); }
.tab-badge[hidden] { display: none; }
.badge-new { color: #111827; background: var(--gold); border-color: var(--gold); font-weight: 800; }

/* ---------- campaign meter history ---------- */
.campaign-history .toolbar { flex-wrap: wrap; gap: .4rem .8rem; } .campaign-history h2 { margin: 0; }
.mh-legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); } .mh-legend i, .mh-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.mh-chart { display: block; width: 100%; height: auto; max-height: 260px; margin-top: .4rem; }
.mh-grid { stroke: var(--line); stroke-width: 1; opacity: .35; } .mh-axis { fill: var(--muted); font-size: 10px; }
.mh-log { margin-top: .5rem; } .mh-log summary { cursor: pointer; color: var(--muted); font-size: .85rem; } .mh-log ul { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .2rem; max-height: 14rem; overflow: auto; }

/* ---------- Personnel Action Requests ---------- */
#view-pars { display: inline-flex; align-items: center; }
.par-tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 .9rem; }
.par-tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; font-weight: 600; padding: .45rem .8rem; cursor: pointer; }
.par-tab:hover { color: var(--text); } .par-tab.on { color: var(--gold); border-bottom-color: var(--gold); }
.par-list { display: grid; gap: .7rem; }
.par-card { border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 8px; padding: .7rem .9rem; background: rgba(15, 23, 42, .5); }
.par-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .35rem; }
.par-change { font-size: .98rem; margin-bottom: .4rem; overflow-wrap: anywhere; }
.par-just p { margin: .1rem 0 .5rem; overflow-wrap: anywhere; }
.par-decision { border-top: 1px dashed var(--line); padding-top: .45rem; } .par-decision p { margin: .2rem 0 0; overflow-wrap: anywhere; }
.par-decision.approved strong { color: var(--ok); } .par-decision.denied strong { color: var(--bad); }
.par-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; } .par-actions:empty { display: none; }
.chip-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.kc-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; margin-bottom: .6rem; }
.kc-view { display: flex; flex-direction: column; gap: .2rem; min-width: min(100%, 22rem); } .kc-view select { max-width: 100%; }
.bm-table.kc-admin .kc-head, .bm-table.kc-admin .kc-row { grid-template-columns: 3rem minmax(0, 1.8fr) minmax(0, 1fr) repeat(4, minmax(4.2rem, .45fr)) 2.4rem; }
.kc-edit { text-align: right; }
.kill-stats h3 { margin: 0 0 .5rem; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 760px) { .bm-table.kc-admin .kc-row { grid-template-columns: 2.2rem repeat(4, 1fr); grid-template-areas: "place who who who edit" ". unit unit unit unit" ". a b c d"; } .kc-row .kc-edit { grid-area: edit; } }

/* the Zeus server tab */
.zs-pill { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #334155; color: #e2e8f0; }
.zs-running .zs-pill { background: #166534; color: #bbf7d0; } .zs-starting .zs-pill, .zs-stopping .zs-pill { background: #854d0e; color: #fde68a; }
.zs-error .zs-pill, .zs-offline .zs-pill { background: #7f1d1d; color: #fecaca; }
.zs-actions { margin-top: .6rem; gap: .5rem; flex-wrap: wrap; } .zs-actions select { min-width: min(100%, 18rem); }
.zs-progress { height: 8px; background: #0f172a; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: .5rem 0; } .zs-progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .15s; }
.zs-log { background: #020617; border: 1px solid var(--line); border-radius: 8px; color: #cbd5e1; font: .76rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; height: 22rem; overflow: auto; padding: .6rem .75rem; margin: .4rem 0; white-space: pre; }

/* ---------- progression: service stripes, MOS tiers, active MOS roles, rank panel ---------- */
.stripes { display: inline-flex; align-items: flex-end; gap: 2px; height: var(--st, 16px); vertical-align: middle; margin-left: .25rem; }
.stripes svg { height: 100%; width: calc(var(--st, 16px) * .375); }
.stripes .st-s polygon { fill: #cbd5e1; } .stripes .st-g polygon { fill: var(--gold); }
.tier-pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .03em; color: #fff; white-space: nowrap; vertical-align: middle; }
.tier-qualified { background: #166534; } .tier-senior { background: #6d28d9; } .tier-instructor { background: #a16207; color: #fff7d1; }
.member { position: relative; }
.member .am-btn { flex: none; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 5px; font: inherit; font-size: .6rem; line-height: 1.3; padding: 0 .3rem; cursor: pointer; white-space: nowrap; } /* small enough not to make the chip wider or taller */
.member .am-btn:hover, .member .am-btn[aria-expanded="true"] { color: var(--text); border-color: var(--gold); }
.member .am-btn b { color: var(--text); }
.am-panel { position: absolute; z-index: 30; left: 0; top: 100%; margin-top: 2px; width: max-content; min-width: 12rem; max-width: 17rem; background: #101827; border: 1px solid var(--gold); border-radius: 8px; padding: .45rem .6rem; font-size: .78rem; cursor: default; box-shadow: 0 6px 18px rgba(0, 0, 0, .5); } /* a popover: opening it never moves the chart */
.am-panel .am-hd { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-bottom: .25rem; }
.am-panel .am-row { display: flex; align-items: flex-start; gap: .45rem; padding: .2rem 0; border-top: 1px solid #1c2638; }
.am-panel .am-ck { width: 1.1rem; flex: none; text-align: center; color: var(--muted); }
.am-panel .am-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.am-panel .am-name { overflow-wrap: anywhere; }
.am-panel .am-tags { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.am-panel .am-note { color: var(--muted); font-size: .68rem; margin-top: .3rem; }
.tag-serving { background: #14532d; color: #bbf7d0; border-radius: 4px; padding: 0 .35rem; font-size: .64rem; font-weight: 700; }
.tag-authorized { background: #1f2937; color: var(--muted); border: 1px dashed #4b5563; border-radius: 4px; padding: 0 .35rem; font-size: .64rem; }
.rank-panel { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .9rem; }
.rank-panel dt { color: var(--muted); } .rank-panel dd { margin: 0; }
.tier-ladder { display: flex; gap: .6rem; flex-wrap: wrap; margin: .6rem 0; }
.tier-ladder > div { flex: 1 1 180px; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; background: #18212f; }
.tier-ladder > div.here { border-color: #ca8a04; }
.tier-ladder ul { margin: .3rem 0 0 1.1rem; padding: 0; font-size: .82rem; color: #d1d5db; }
.tier-ladder .bar { height: 6px; background: #334155; border-radius: 3px; overflow: hidden; margin-top: .35rem; } .tier-ladder .bar i { display: block; height: 100%; background: var(--warn); }
.tier-ladder .bar.full i { background: var(--ok); }
.promo-pill { font-size: .68rem; }
.promo-table td, .promo-table th { white-space: nowrap; }
.promo-table td.ok-cell { color: var(--ok); } .promo-table td.short-cell { color: var(--warn); }
.mos-members .m-tier { margin-left: .3rem; }

.stripes-col { width: 7rem; white-space: nowrap; } .stripes-col .stripes { margin-left: 0; }

/* acting rank: a small diamond after the rank label, with a tooltip (it does not move the layout) */
.act-mark { color: var(--gold); font-size: .62em; margin-left: .1em; vertical-align: .2em; cursor: help; font-style: normal; font-weight: 400; }

/* a MOS name takes the colour of the tier the member has reached in it (Qualified keeps the usual blue) */
.mos-tag.tier-senior { color: #e9d5ff; }
.mos-tag.tier-instructor { color: #fff1b8; }
.mos-tag.tier-senior { background: #3b1d73; border-color: #7c3aed; }
.mos-tag.tier-instructor { background: #4a3408; border-color: #ca8a04; }

/* the Next rank card on a profile */
.next-rank .progress-row { margin: .5rem 0; max-width: 34rem; }
.next-rank .pr-label { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.next-rank .pr-ok { color: var(--ok); font-weight: 700; }
.pbar { height: 8px; background: #334155; border-radius: 4px; overflow: hidden; margin-top: .25rem; }
.pbar i { display: block; height: 100%; background: var(--warn); } .pbar.full i { background: var(--ok); }

/* a MOS card takes the colour of the tier the person looking at the page has reached in it (nothing for a MOS they do not hold) */
.mos-card[data-held-tier="qualified"] { border-color: #22c55e; box-shadow: 0 0 0 1px #22c55e55 inset; }
.mos-card[data-held-tier="senior"] { border-color: #8b5cf6; box-shadow: 0 0 0 1px #8b5cf655 inset; }
.mos-card[data-held-tier="instructor"] { border-color: #eab308; box-shadow: 0 0 0 1px #eab30855 inset; }

.prereq-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.prereq-row select { flex: none; max-width: 9rem; }
