@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,400&family=Saira+Condensed:wght@500;600;700&display=swap');

/* ---------------------------------------------------------------------------
   Tokens — dark operations console.
--------------------------------------------------------------------------- */
:root {
  --bg: #080c12;
  --bg-2: #0b111a;
  --chrome: #070b11;
  --card: #101825;
  --card-2: #0d1420;
  --raised: #16202f;
  --line: #1e2836;
  --line-2: #263243;

  --text: #e6edf3;
  --text-soft: #93a1b1;
  --muted: #6b7a8c;

  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, .14);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, .12);
  --signal: #f59e0b;
  --signal-soft: rgba(245, 158, 11, .12);
  --alert: #ef4444;
  --alert-soft: rgba(239, 68, 68, .12);

  --display: 'Saira Condensed', 'Arial Narrow', sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --wrap: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: .01em; margin: 0 0 .4em; line-height: 1.1; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--text-soft); }
.tiny { font-size: .82rem; }
.mono { font-family: var(--mono); }

.eyebrow {
  font-family: var(--display); font-weight: 600; font-size: .78rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
  display: inline-block; margin-bottom: .5rem;
}
.eyebrow--onDark { color: var(--accent); }

/* ---------------------------------------------------------------------------
   Chrome
--------------------------------------------------------------------------- */
.masthead { background: var(--chrome); border-bottom: 1px solid var(--line); }
.masthead__inner { display: flex; align-items: center; gap: 1.5rem; padding: .8rem 0; }

.logo { display: flex; align-items: baseline; gap: .55rem; }
.logo:hover { text-decoration: none; }
.logo { align-items: center; }
.logo__img { width: 36px; height: 36px; object-fit: contain; border-radius: var(--radius-sm); }
.logo__word { font-family: var(--display); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

.nav { display: flex; gap: .15rem; margin-left: auto; flex-wrap: wrap; align-items: center; }
.nav a {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .1em; font-size: .84rem;
  font-weight: 600; color: var(--text-soft); padding: .45rem .7rem; border-radius: var(--radius-sm);
}
.nav a:hover { background: var(--raised); color: #fff; text-decoration: none; }
.nav a[aria-current='page'] { color: #fff; background: var(--accent); }

.who { display: flex; align-items: center; gap: .6rem; padding-left: 1rem; margin-left: .5rem; border-left: 1px solid var(--line); }
.who img { width: 30px; height: 30px; border-radius: 50%; }
.who__name { font-size: .85rem; color: var(--text); }
.who__role { font-family: var(--mono); font-size: .66rem; color: var(--accent); text-transform: uppercase; }

.rail { background: var(--bg-2); border-bottom: 1px solid var(--line); color: var(--text-soft); font-family: var(--mono); font-size: .75rem; }
.rail__inner { display: flex; gap: 1.75rem; padding: .5rem 0; flex-wrap: wrap; align-items: center; }
.rail b { color: var(--text); font-weight: 500; }
.rail__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; margin-right: .45rem; vertical-align: 1px; }
.rail__dot--on { background: var(--ok); animation: pulse 2.4s ease-out infinite; }
.rail__dot--off { background: var(--alert); }
.rail__links { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.rail__links a { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-soft); }
.rail__links a:hover { color: var(--accent); text-decoration: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@media (prefers-reduced-motion: reduce) { .rail__dot--on { animation: none; } }

.main { padding: 2rem 0 4rem; }
.foot { background: var(--chrome); border-top: 1px solid var(--line); color: var(--muted); padding: 2rem 0; font-size: .85rem; }
.foot__inner { text-align: center; }
.foot__copy { margin: 0 0 .5rem; color: var(--text-soft); }
.foot__notice { margin: 0 auto; max-width: 62ch; font-size: .8rem; line-height: 1.6; }
.foot__notice strong { color: var(--text-soft); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Panels, grids, tables
--------------------------------------------------------------------------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel__head { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.15rem; border-bottom: 1px solid var(--line); }
.panel__head h2, .panel__head h3 { margin: 0; }
.panel__body { padding: 1.15rem; }
.panel__foot { padding: .8rem 1.15rem; border-top: 1px solid var(--line); background: var(--card-2); }

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 900px) { .grid--sidebar { grid-template-columns: 1fr; } }

.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; }
.card-link:hover .panel { border-color: var(--accent); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 2.25rem 0 1rem; flex-wrap: wrap; }
.section-head:first-child { margin-top: 0; }
.section-head h1, .section-head h2 { margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  font-family: var(--body); font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  font-size: .7rem; color: var(--muted); text-align: left; padding: .6rem .85rem;
  background: var(--card-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: .65rem .85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--raised); }
.table-scroll { overflow-x: auto; }

/* ---------------------------------------------------------------------------
   Chips
--------------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--body); font-weight: 600; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .18rem .45rem; border-radius: var(--radius-sm);
  background: var(--raised); color: var(--text-soft); border: 1px solid var(--line-2);
  white-space: nowrap;
}
.chip--ok     { background: var(--ok-soft);     color: var(--ok);     border-color: rgba(34,197,94,.3); }
.chip--info   { background: var(--accent-soft); color: var(--accent); border-color: rgba(59,130,246,.35); }
.chip--signal { background: var(--signal-soft); color: var(--signal); border-color: rgba(245,158,11,.35); }
.chip--alert  { background: var(--alert-soft);  color: var(--alert);  border-color: rgba(239,68,68,.3); }
.chip--mute   { background: var(--raised);      color: var(--muted); }

.crud { display: inline-flex; gap: 2px; font-family: var(--mono); font-size: .66rem; }
.crud span { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 4px; background: var(--raised); color: var(--muted); }
.crud span.on { background: var(--accent); color: #fff; }

/* ---------------------------------------------------------------------------
   Forms and buttons
--------------------------------------------------------------------------- */
label { display: block; font-family: var(--body); font-weight: 600; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
input[type=text], input[type=number], input[type=email], input[type=date], input[type=url],
input[type=color], input[type=search], input[type=password], select, textarea {
  width: 100%; padding: .55rem .7rem; font: 400 .92rem var(--body); color: var(--text);
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
input[type=color] { padding: .2rem; height: 2.4rem; }
textarea { min-height: 6rem; resize: vertical; font-family: var(--body); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field + .field { margin-top: .85rem; }
.field--inline { display: flex; align-items: center; gap: .5rem; }
.field--inline label { margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .9rem; color: var(--text); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  font-family: var(--body); font-weight: 600; font-size: .85rem;
  padding: .5rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--raised); color: var(--text);
}
.btn:hover { background: var(--line-2); text-decoration: none; color: #fff; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #2f74e8; }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--raised); }
.btn--danger { background: transparent; color: var(--alert); border-color: rgba(239,68,68,.35); }
.btn--danger:hover { background: var(--alert); color: #fff; }
.btn--sm { padding: .3rem .55rem; font-size: .76rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Segmented control, as used for Main Roster / Subdivision Rosters / Settings. */
.segmented { display: inline-flex; gap: .2rem; padding: .2rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.segmented a, .segmented button {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  font: 600 .82rem var(--body); color: var(--text-soft);
  padding: .38rem .7rem; border: 0; border-radius: 5px; background: transparent;
}
.segmented a:hover, .segmented button:hover { color: #fff; background: var(--raised); text-decoration: none; }
.segmented [aria-current='page'], .segmented .is-active { background: var(--raised); color: #fff; box-shadow: inset 0 0 0 1px var(--line-2); }
.segmented--icons a, .segmented--icons button { padding: .38rem .5rem; }
.segmented--icons .is-active { background: var(--accent); color: #fff; box-shadow: none; }

/* ---------------------------------------------------------------------------
   Flashes, notes, empties
--------------------------------------------------------------------------- */
.flash { border-left: 3px solid var(--accent); background: var(--card); border-radius: var(--radius-sm); padding: .7rem 1rem; }
.flash + .flash { margin-top: .5rem; }
.flash--ok { border-left-color: var(--ok); }
.flash--error { border-left-color: var(--alert); }
.flashes { margin-bottom: 1.5rem; }

.note { border: 1px solid var(--line-2); background: var(--card-2); padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; }
.note--warn { border-color: rgba(245,158,11,.4); background: var(--signal-soft); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-soft); }
.empty h3 { color: var(--text); }

/* ---------------------------------------------------------------------------
   Stat cards
--------------------------------------------------------------------------- */
.stats { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1rem; text-align: center; }
.stat__value { font-family: var(--display); font-weight: 700; font-size: 2.1rem; line-height: 1; color: var(--text); }
.stat__label { font-size: .78rem; color: var(--text-soft); margin-top: .35rem; }
.stat--ok .stat__value { color: var(--ok); }
.stat--signal .stat__value { color: var(--signal); }
.stat--info .stat__value { color: var(--accent); }

/* ---------------------------------------------------------------------------
   Org / page header
--------------------------------------------------------------------------- */
.org-head { margin: -2rem calc(50% - 50vw) 1.75rem; padding: 1.6rem calc(50vw - 50%) 0; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.org-head h1 { margin-bottom: .1rem; }
.org-head p { color: var(--text-soft); margin: 0 0 1rem; max-width: 62ch; }
.org-head__bar { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.org-head__flag { width: 5px; align-self: stretch; min-height: 46px; border-radius: 3px; }
.org-head__crest { width: 54px; height: 54px; border-radius: var(--radius-sm); object-fit: contain; background: var(--card); padding: 4px; }
.org-head__actions { margin-left: auto; }

.tabs { display: flex; gap: .15rem; overflow-x: auto; }
.tabs a {
  font-family: var(--body); font-weight: 600; font-size: .85rem;
  color: var(--text-soft); padding: .6rem .85rem; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: #fff; text-decoration: none; }
.tabs a[aria-current='page'] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------------------
   Roster: shared pieces
--------------------------------------------------------------------------- */
.roster-toolbar {
  display: flex; gap: .7rem; flex-wrap: wrap; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; margin-bottom: 1rem;
}
.roster-toolbar .search { flex: 1 1 280px; position: relative; }
.roster-toolbar .search input { padding-left: 2.1rem; }
.roster-toolbar .search svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.roster-toolbar select { width: auto; min-width: 150px; flex: 0 0 auto; }
.roster-expand { display: flex; gap: 1rem; justify-content: flex-end; margin-bottom: .75rem; }
.roster-expand button { background: none; border: 0; color: var(--text); font: 600 .85rem var(--body); cursor: pointer; padding: .2rem 0; }
.roster-expand button:hover { color: var(--accent); }

.rank-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .85rem; overflow: hidden; }
.rank-head {
  display: flex; align-items: center; gap: .85rem; width: 100%; text-align: left;
  padding: .85rem 1rem; background: var(--card); border: 0; cursor: pointer; color: inherit;
}
.rank-head:hover { background: var(--raised); }
.rank-head__icon {
  width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center;
  background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--radius-sm); color: var(--muted);
}
.rank-head__icon--command { color: var(--signal); }
.rank-head__name { font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: var(--text); }
.rank-head__sub { font-size: .8rem; color: var(--text-soft); }
.rank-head__sub .vacant { color: var(--signal); }
.rank-head__chev { margin-left: auto; color: var(--muted); transition: transform .15s ease; }
.rank-block.is-collapsed .rank-head__chev { transform: rotate(-90deg); }
.rank-block.is-collapsed .rank-body { display: none; }
@media (prefers-reduced-motion: reduce) { .rank-head__chev { transition: none; } }

.badge-no { font-family: var(--mono); font-size: .84rem; color: var(--accent); }
.callsign { font-family: var(--mono); font-size: .84rem; color: var(--text-soft); }

.avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  display: inline-grid; place-items: center; object-fit: cover;
  background: var(--raised); border: 1px solid var(--line-2);
  font: 600 .66rem var(--body); color: var(--text-soft); letter-spacing: .02em;
}
.avatar--lg { width: 38px; height: 38px; flex-basis: 38px; font-size: .78rem; }
.person { display: flex; align-items: center; gap: .6rem; }

/* Slot table */
.slot-row--vacant td { background: rgba(245, 158, 11, .04); }
.slot-row--vacant:hover td { background: rgba(245, 158, 11, .07); }
.vacant-label { color: var(--signal); font-style: italic; display: inline-flex; align-items: center; gap: .4rem; }

/* Personnel list */
.person-row { display: flex; align-items: center; gap: .75rem; padding: .65rem 1rem; border-top: 1px solid var(--line); }
.person-row:hover { background: var(--raised); }
.person-row__main { min-width: 0; }
.person-row__name { font-weight: 600; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.person-row__meta { font-family: var(--mono); font-size: .78rem; color: var(--text-soft); display: flex; gap: .8rem; flex-wrap: wrap; }
.person-row__tags { margin-left: auto; display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }

/* Certification chip, with a marked variant for instructors. */
.cert { border-color: var(--line-2); }
.cert--instructor { border-color: rgba(59,130,246,.4); color: var(--accent); background: var(--accent-soft); }
.cert__mark { font-size: .8em; }

/* Card grid view */
.person-cards { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); padding: 1rem; }
.person-card { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .85rem; }
.person-card__top { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; }

/* ---------------------------------------------------------------------------
   Public community roster
--------------------------------------------------------------------------- */
.community-head { margin: -2rem calc(50% - 50vw) 2rem; padding: 2.5rem calc(50vw - 50%); background: var(--bg-2); border-bottom: 1px solid var(--line); }
.community-head__bar { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.community-head__crest {
  width: 84px; height: 84px; border-radius: var(--radius); display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid rgba(59,130,246,.3);
  font: 700 1.9rem var(--display); color: var(--accent); letter-spacing: .05em;
}
.community-head h1 { margin: 0; }
.community-head .sub { color: var(--text-soft); margin: .1rem 0 .7rem; }

.leader-card { display: flex; gap: .75rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; }
.leader-card__name { font-weight: 600; }

.dept-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dept-tab {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .45rem .7rem; font: 600 .88rem var(--body); color: var(--text-soft);
}
.dept-tab:hover { border-color: var(--line-2); text-decoration: none; }
.dept-tab.is-active { background: var(--raised); color: #fff; border-color: var(--accent); }
.dept-tab__count { font-family: var(--mono); font-size: .72rem; background: var(--raised); border-radius: 4px; padding: .05rem .35rem; color: var(--text-soft); }

/* ---------------------------------------------------------------------------
   Editors
--------------------------------------------------------------------------- */
.grid-editor table { font-size: .86rem; }
.grid-editor input, .grid-editor select { border-color: transparent; background: transparent; padding: .3rem .35rem; }
.grid-editor input:hover, .grid-editor select:hover { border-color: var(--line-2); }
.grid-editor input:focus, .grid-editor select:focus { background: var(--card-2); border-color: var(--accent); }
.grid-editor td { padding: .15rem .25rem; }
.grid-editor .drag { cursor: grab; color: var(--muted); font-family: var(--mono); user-select: none; }
.grid-editor tr.is-dragging { opacity: .4; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(8,12,18,.94); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: .75rem 0; margin-top: 1rem; z-index: 5; }

.editor-toolbar {
  display: flex; gap: .2rem; flex-wrap: wrap; padding: .5rem; background: var(--card);
  border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
  position: sticky; top: 0; z-index: 4;
}
.editor-toolbar button { font-family: var(--mono); font-size: .76rem; padding: .3rem .5rem; min-width: 30px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 4px; cursor: pointer; color: var(--text); }
.editor-toolbar button:hover { border-color: var(--accent); }
.editor-toolbar .sep { width: 1px; background: var(--line-2); margin: 0 .25rem; }
/* The document page stays light — it is a printable document, not chrome. */
.editor-surface {
  background: #fff; color: #16202a; border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 3rem clamp(1rem, 6vw, 4.5rem); min-height: 60vh; outline: none;
}
.editor-surface a { color: #1d4f7c; }
.editor-surface:focus { border-color: var(--accent); }

.fb-field { background: var(--card-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: .8rem; border-radius: var(--radius-sm); }
.fb-field + .fb-field { margin-top: .6rem; }
.fb-field__top { display: flex; gap: .5rem; align-items: center; }
.fb-field__top .grow { flex: 1; }
.fb-preview { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }

/* ---------------------------------------------------------------------------
   Prose and org chart
--------------------------------------------------------------------------- */
.prose { max-width: 74ch; }
.prose h2 { font-size: 1.3rem; margin-top: 1.8rem; }
.prose h3 { font-size: 1.08rem; margin-top: 1.4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: .3rem; }
.prose blockquote { border-left: 3px solid var(--accent); margin: 1rem 0; padding-left: 1rem; color: var(--text-soft); }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--raised); padding: .1rem .3rem; border-radius: 4px; }
.prose table { margin: 1rem 0; }
.prose table td, .prose table th { border: 1px solid var(--line); }
.editor-surface.prose code { background: #eef0ec; }
.editor-surface.prose blockquote { color: #4a5560; }
.editor-surface.prose table td, .editor-surface.prose table th { border-color: #d5d8d2; }

.article { border-bottom: 1px solid var(--line); padding: 1.25rem 0; }
.article:last-child { border-bottom: 0; }
.article h3 { margin-bottom: .15rem; }
.article__meta { font-family: var(--mono); font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.entry { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 1.25rem; padding: 1.35rem 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
@media (max-width: 640px) { .entry { grid-template-columns: 1fr; gap: .4rem; } }
.entry__stamp { font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.entry__version { font-family: var(--display); font-size: 1.1rem; color: var(--accent); font-weight: 700; }

.hero { background: var(--bg-2); border-bottom: 1px solid var(--line); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; }
@media (max-width: 820px) { .hero__grid { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
.hero p { color: var(--text-soft); font-size: 1.02rem; max-width: 46ch; }

.board { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; font-family: var(--mono); }
.board__row { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .82rem; color: var(--text-soft); }
.board__row:last-child { border-bottom: 0; }
.board__row b { color: var(--text); font-weight: 500; }
.board__big { font-family: var(--display); font-size: 3.2rem; color: var(--accent); line-height: 1; }

.chart { overflow-x: auto; padding: 1.5rem .5rem; }
.chart ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 1rem; }
.chart li { position: relative; padding: 1.6rem .5rem 0; text-align: center; }
.chart li::before, .chart li::after { content: ''; position: absolute; top: 0; height: 1.6rem; width: 50%; border-top: 1px solid var(--line-2); }
.chart li::before { left: 0; border-right: 1px solid var(--line-2); }
.chart li::after { right: 0; }
.chart li:only-child::before, .chart li:only-child::after { display: none; }
.chart li:only-child { padding-top: 1.6rem; }
.chart li:first-child::before, .chart li:last-child::after { border-top: 0; }
.chart li:last-child::before { border-right: 1px solid var(--line-2); }
.chart > ul > li { padding-top: 0; }
.chart > ul > li::before, .chart > ul > li::after { display: none; }
.chart ul ul { position: relative; padding-top: 1.6rem; }
.chart ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 1.6rem; border-left: 1px solid var(--line-2); }
.chart__node { display: inline-block; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--line-2); border-radius: var(--radius-sm); padding: .5rem .8rem; min-width: 150px; }
.chart__node strong { display: block; font-family: var(--display); font-size: 1rem; }
.chart__node span { font-family: var(--mono); font-size: .68rem; color: var(--muted); text-transform: uppercase; }
.chart__node--rank { border-top-color: var(--accent); }

.acl-table td { font-size: .85rem; }
.is-hidden { display: none !important; }

@media print {
  .masthead, .rail, .foot, .no-print, .tabs, .roster-toolbar, .roster-expand { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .rank-block, .editor-surface { border-color: #ccc; }
}

/* ---------------------------------------------------------------------------
   Canvas org chart
   Free placement, because a real department chart is a grid of banners and
   parallel division columns rather than a strict tree.
--------------------------------------------------------------------------- */
.canvas-wrap { overflow: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.canvas {
  position: relative;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  background-position: -1px -1px;
}
.canvas--plain { background-image: none; }
.canvas__links { position: absolute; inset: 0; pointer-events: none; }
.canvas__links path { fill: none; stroke: var(--line-2); stroke-width: 2; }

.cnode { position: absolute; border-radius: var(--radius-sm); overflow: hidden; }
.cnode__head {
  font-family: var(--display); font-weight: 700; font-size: .95rem; letter-spacing: .02em;
  color: #fff; padding: .4rem .6rem; text-align: center; line-height: 1.25;
}
.cnode__sub { display: block; font-family: var(--body); font-weight: 500; font-size: .68rem; opacity: .85; letter-spacing: .06em; text-transform: uppercase; }

/* Rank box: a header plus one row per slot, like the sheet it replaces. */
.cnode--rank { background: var(--card); border: 1px solid var(--line-2); }
.cnode__rows { display: block; }
.cnode__row {
  display: grid; grid-template-columns: auto 1fr auto; gap: .4rem; align-items: center;
  padding: .28rem .5rem; border-top: 1px solid var(--line);
  font-size: .82rem;
}
.cnode__row:first-child { border-top: 0; }
.cnode__badge { font-family: var(--mono); font-size: .76rem; color: var(--accent); }
.cnode__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnode__row--vacant { background: rgba(245, 158, 11, .06); }
.cnode__row--vacant .cnode__name { color: var(--signal); font-style: italic; }
.cnode__warn {
  background: var(--signal-soft); color: var(--signal); border-bottom: 1px solid rgba(245,158,11,.35);
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  padding: .25rem .5rem; text-align: center;
}
.cnode__empty { padding: .5rem; color: var(--muted); font-size: .8rem; text-align: center; }
.cnode__dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot--ok { background: var(--ok); } .dot--info { background: var(--accent); }
.dot--signal { background: var(--signal); } .dot--alert { background: var(--alert); }
.dot--mute { background: var(--muted); }

/* Full-width section banner, e.g. "Division Command". */
.cnode--banner .cnode__head { font-size: 1.05rem; letter-spacing: .1em; text-transform: uppercase; }
.cnode--label .cnode__head { font-size: .88rem; letter-spacing: .08em; text-transform: uppercase; }
.cnode--text { background: var(--card); border: 1px solid var(--line-2); padding: .6rem; font-size: .84rem; color: var(--text-soft); }

/* Editing affordances, only present for editors. */
.canvas--edit .cnode { cursor: grab; touch-action: none; user-select: none; }
.canvas--edit .cnode.is-selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.canvas--edit .cnode.is-dragging { opacity: .75; cursor: grabbing; }
.cnode__grip {
  position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; cursor: ew-resize;
  background: linear-gradient(135deg, transparent 50%, var(--accent) 50%);
}
.canvas-size { display: inline-flex; align-items: center; gap: .35rem; }
.canvas-size label { margin: 0; }
.canvas-size input { width: 76px; padding: .3rem .4rem; font-size: .8rem; }
.chart-tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.chart-inspector { position: sticky; top: 1rem; }
.chart-inspector .field + .field { margin-top: .6rem; }
@media print {
  .canvas { background-image: none; }
  .canvas-wrap { overflow: visible; border: 0; }
}
