/* =========================================================================
   Guild site theme - dark stone, aged gold, Celtic interlace.
   ========================================================================= */

:root {
  --ink:        #0c0a08;
  --stone-900:  #141110;
  --stone-800:  #1c1815;
  --stone-700:  #26211c;
  --stone-600:  #332b24;
  --stone-500:  #463c32;

  --gold:       #c9a227;
  --gold-bright:#f0d98d;
  --gold-dim:   #7d6420;
  --parchment:  #e8dcc0;
  --text:       #d9cfbe;
  --text-dim:   #9a8f7d;
  --text-faint: #6f6656;

  --jade:       #4f9d8f;
  --blood:      #b8432f;
  --violet:     #9a7fbf;
  --azure:      #6f8fd0;
  --bone:       #cfc4a8;

  --ok:    #6fae5f;
  --warn:  #d9a441;
  --bad:   #c4513b;

  --radius: 3px;
  --shadow: 0 10px 30px rgba(0,0,0,.55);

  --font-display: 'Cinzel', Georgia, 'Times New Roman', serif;
  --font-body: 'Spectral', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(201,162,39,.10), transparent 60%),
    linear-gradient(180deg, var(--stone-900), var(--ink) 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Faint interlace weave over the whole page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%23c9a227' stroke-width='1'%3E%3Cpath d='M0,30 C15,30 15,0 30,0 C45,0 45,30 60,30'/%3E%3Cpath d='M0,30 C15,30 15,60 30,60 C45,60 45,30 60,30'/%3E%3C/g%3E%3C/svg%3E");
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---- typography --------------------------------------------------------- */

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--gold-bright);
  margin: 0 0 .5em;
  line-height: 1.25;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); text-decoration: underline; text-underline-offset: 3px; }

code, kbd, pre { font-family: var(--font-mono); font-size: .875em; }
pre {
  background: var(--ink);
  border: 1px solid var(--stone-600);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
}
code:not(pre code) {
  background: rgba(0,0,0,.4);
  border: 1px solid var(--stone-600);
  border-radius: 2px;
  padding: 1px 5px;
  color: var(--gold-bright);
}

hr.knot {
  border: 0;
  height: 30px;
  margin: 28px 0;
  background: center/auto 26px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='26' viewBox='0 0 120 26'%3E%3Cg fill='none' stroke='%237d6420' stroke-width='2'%3E%3Cpath d='M0,13 H36'/%3E%3Cpath d='M84,13 H120'/%3E%3Cpath d='M60,3 C69,12 69,16 60,23 C51,16 51,12 60,3 Z'/%3E%3Cpath d='M48,21 C49,10 55,6 63,9 C60,17 55,21 48,21 Z'/%3E%3Cpath d='M72,21 C71,10 65,6 57,9 C60,17 65,21 72,21 Z'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- the Celtic frame --------------------------------------------------- */

.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(38,33,28,.92), rgba(20,17,16,.94));
  border: 26px solid transparent;
  border-image-source: url('/img/frame-celtic.svg');
  border-image-slice: 46;
  border-image-repeat: round;
  border-image-width: 26px;
  padding: 4px 18px 16px;
  margin: 0 0 26px;
  box-shadow: var(--shadow);
  z-index: 1;
}

/* A lighter box for dense content where the full frame is too busy */
.box {
  position: relative;
  background: linear-gradient(180deg, rgba(38,33,28,.7), rgba(20,17,16,.8));
  border: 1px solid var(--stone-600);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  z-index: 1;
}
.box::before,
.box::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid var(--gold-dim);
  pointer-events: none;
}
.box::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.box::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.panel > h2:first-child,
.panel > .panel-head { margin-top: 0; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--stone-600);
}
.panel-head h2 { margin: 0; flex: 1 1 auto; }
.panel-head .spacer { flex: 1 1 auto; }

.panel-icon {
  width: 34px; height: 34px;
  color: var(--gold);
  flex: 0 0 auto;
  filter: drop-shadow(0 0 6px rgba(201,162,39,.35));
}

/* ---- app shell ---------------------------------------------------------- */

.app { position: relative; z-index: 1; }

.boot {
  min-height: 70vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--text-dim);
}
.boot-mark { width: 72px; height: 72px; color: var(--gold-dim); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: .9; } }

.masthead {
  border-bottom: 2px solid var(--stone-700);
  background: linear-gradient(180deg, rgba(20,17,16,.96), rgba(12,10,8,.9));
  position: relative;
}
.masthead::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--gold-dim) 0 10px, transparent 10px 22px);
  opacity: .5;
}

.masthead-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.crest {
  width: 58px; height: 58px;
  color: var(--gold);
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 8px rgba(201,162,39,.4));
}

.brand { flex: 1 1 260px; min-width: 0; }
.brand h1 {
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  margin: 0;
  text-shadow: 0 2px 10px rgba(0,0,0,.8);
}
.brand p {
  margin: 2px 0 0;
  color: var(--text-faint);
  font-style: italic;
  font-size: .9rem;
}

.whoami {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
  flex: 0 0 auto;
}
.whoami .name { color: var(--parchment); font-weight: 600; }

/* ---- navigation --------------------------------------------------------- */

.nav {
  background: rgba(8,7,6,.75);
  border-bottom: 1px solid var(--stone-700);
}
.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: .82rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.nav a:hover { color: var(--gold-bright); background: rgba(201,162,39,.07); text-decoration: none; }
.nav a.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
  background: linear-gradient(180deg, rgba(201,162,39,.12), transparent);
}
.nav a svg { width: 17px; height: 17px; opacity: .85; }

/* Pending applications. Loud on purpose - this is the one nav item that is a
   queue, and an unread queue should nag. */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-family: var(--font-body, inherit);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 10px rgba(196,81,59,.55);
  animation: badge-pulse 2.4s ease-in-out infinite;
}
.nav a:hover .nav-badge, .nav a.active .nav-badge { animation: none; }

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 10px rgba(196,81,59,.55); }
  50%      { box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 16px rgba(196,81,59,.95); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-badge { animation: none; }
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 22px 80px;
}

.site-foot {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 22px 40px;
  color: var(--text-faint);
  font-size: .8rem;
  text-align: center;
  border-top: 1px solid var(--stone-700);
}

/* ---- forms and controls -------------------------------------------------- */

label { display: block; font-size: .8rem; color: var(--text-dim); margin-bottom: 5px; letter-spacing: .04em; text-transform: uppercase; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=search], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--stone-600);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: .95rem;
  padding: 9px 11px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { font-family: var(--font-mono); font-size: .85rem; line-height: 1.65; resize: vertical; min-height: 140px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,.16);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 180px; margin-bottom: 14px; }
.hint { font-size: .78rem; color: var(--text-faint); margin-top: 4px; text-transform: none; letter-spacing: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--stone-500);
  background: linear-gradient(180deg, var(--stone-700), var(--stone-800));
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold-dim); color: var(--gold-bright); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  border-color: var(--gold-dim);
  background: linear-gradient(180deg, #4a3c14, #2c2410);
  color: var(--gold-bright);
}
.btn-primary:hover { background: linear-gradient(180deg, #5d4a18, #3a2f14); box-shadow: 0 0 14px rgba(201,162,39,.25); }
.btn-danger { border-color: #6b2b20; color: #e79a8b; }
.btn-danger:hover { background: #3a1a14; border-color: var(--blood); color: #ffb3a3; }
.btn-sm { padding: 5px 10px; font-size: .7rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { border-color: var(--stone-500); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* toggle switch used all over the permission grid */
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; text-transform: none; letter-spacing: 0; margin: 0; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  width: 38px; height: 21px; border-radius: 11px;
  background: var(--stone-700);
  border: 1px solid var(--stone-500);
  position: relative; flex: 0 0 auto;
  transition: background .18s, border-color .18s;
}
.toggle .track::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--text-faint);
  transition: transform .18s, background .18s;
}
.toggle input:checked + .track { background: rgba(201,162,39,.3); border-color: var(--gold); }
.toggle input:checked + .track::after { transform: translateX(17px); background: var(--gold-bright); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(201,162,39,.25); }
.toggle input:disabled + .track { opacity: .4; cursor: not-allowed; }
.toggle .label { font-size: .85rem; color: var(--text); }

/* ---- tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  text-align: left;
  font-family: var(--font-display);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  padding: 8px 10px;
  border-bottom: 1px solid var(--stone-600);
  white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid rgba(51,43,36,.55); vertical-align: middle; }
tbody tr:hover { background: rgba(201,162,39,.05); }
td.num, th.num { text-align: right; font-family: var(--font-mono); }

/* ---- badges, pills, chips ------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-display);
  font-size: .66rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
  border: 1px solid currentColor;
  background: rgba(0,0,0,.35);
  white-space: nowrap;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .74rem;
  padding: 2px 9px;
  border-radius: 3px;
  border: 1px solid var(--stone-500);
  background: rgba(0,0,0,.3);
  color: var(--text-dim);
  white-space: nowrap;
}
.chip.on { border-color: var(--gold-dim); color: var(--gold-bright); background: rgba(201,162,39,.12); }
.chip .val { font-family: var(--font-mono); font-size: .72rem; color: var(--parchment); }

/*
 * The one chip on a roster row you can press. It was the "+3" that opened a
 * row's folded tag chips; the fold is gone with the trophy case, and the class
 * is kept for what stands in the same place - the muted "Choose tags to show"
 * an owner is offered on a character with an empty case. It is a real <button>
 * so Tab and Enter reach it without any code of ours, and it wears .chip for
 * everything else - only the three things a button gets wrong are said here.
 * font: inherit because a button otherwise takes the browser's own face and
 * reads as a different typeface sitting among the chips; the size has to be
 * restated after it, since the shorthand resets that too. Hover borrows the
 * gold .chip.on wears, so the one chip you can press is the one that answers.
 */
button.chip-more { font: inherit; font-size: .74rem; cursor: pointer; }
button.chip-more:hover { border-color: var(--gold-dim); color: var(--gold-bright); }
button.chip-more:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(201,162,39,.25); }

.pill-inactive { color: var(--text-faint); border-color: var(--stone-500); }

/* ---- attendance meter ---------------------------------------------------- */

/*
 * A very dark bar with a very bright number printed over it. The number crosses
 * the fill and the empty track both, so both are dark: the bright tint clears
 * 6.5:1 on the lightest fill and 14:1 on the track. The status colour lives in
 * the border, the fill and the tint of the number.
 */
.att { display: inline-flex; align-items: center; }
.att-bar {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 92px; height: 20px;
  background: #0e0c0a;
  border: 1px solid var(--att-edge, var(--stone-600));
  border-radius: 4px;
  overflow: hidden;
  flex: 0 0 auto;
}
.att-fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--att-fill);
  transition: width .4s;
}
.att-val {
  position: relative;
  font-family: var(--font-mono); font-size: .8rem; font-weight: 600;
  line-height: 1; letter-spacing: .02em;
  color: var(--att-ink);
  text-shadow: 0 1px 1px rgba(0,0,0,.6);
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) { .att-fill { transition: none; } }
.att-good { --att-fill: #2e5a24; --att-edge: #4d7a3f; --att-ink: #d8f5cc; }
.att-mid  { --att-fill: #6a4d0e; --att-edge: #8a6a1c; --att-ink: #ffe8b0; }
.att-low  { --att-fill: #7c2618; --att-edge: #9a3a28; --att-ink: #ffd3c7; }

/* ---- roster -------------------------------------------------------------- */

.roster-toolbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 20px;
}
.roster-toolbar .field { margin-bottom: 0; }
.seg {
  display: inline-flex;
  border: 1px solid var(--stone-600);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg button {
  background: var(--stone-800);
  border: 0;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: .74rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 9px 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg button + button { border-left: 1px solid var(--stone-600); }
.seg button:hover { color: var(--gold-bright); }
.seg button.on { background: linear-gradient(180deg, #4a3c14, #2c2410); color: var(--gold-bright); }

/* A table row for someone parked or retired - the standings, the raid sheet,
   and the roster's own rows. */
tr.is-inactive { opacity: .6; }

/* ---- roster: accounts and characters as rows ------------------------------- */

/* position: relative makes the table the containing block for anything absolutely
   positioned inside it - the visually hidden column labels. Without it their
   containing block was the panel OUTSIDE .table-wrap, so the scroll container
   could not clip them: the Actions label sat wherever the last column ended and
   pushed the whole page 400px wider than a phone. Scoped to the roster, rather
   than set on .table-wrap, so nothing elsewhere that is meant to spill out of
   its table is clipped by it. */
.roster-table { position: relative; }
.roster-table td { vertical-align: middle; }

/* An account row reads as the head of its group, with its characters under it. */
.acct-row td { border-bottom-color: var(--stone-600); background: rgba(0,0,0,.18); }
.acct-row td:first-child { box-shadow: inset 2px 0 0 var(--accent, var(--gold-dim)); }
.acct-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 2px 0; margin: 0;
  color: inherit; font: inherit; cursor: pointer; text-align: left;
}
.acct-toggle .caret { color: var(--gold); width: 1em; display: inline-block; }
.acct-name { font-family: var(--font-display); font-size: 1rem; color: var(--parchment); }
.acct-toggle:hover .acct-name { color: var(--gold-bright); }

.char-sub-row td:first-child { padding-left: 34px; }

/* A character's name is the door into its sheet, so it looks like one. */
.name-btn {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--parchment); cursor: pointer; text-align: left;
}
.name-btn:hover { color: var(--gold-bright); text-decoration: underline; text-underline-offset: 3px; }
.name-btn .main-star { color: var(--gold); font-size: .8em; }
.acct-toggle:focus-visible, .name-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

.cell-sub { display: block; font-size: .76rem; color: var(--text-faint); }

/* ---- loot ------------------------------------------------------------------- */

.loot-table td { vertical-align: middle; }
.loot-thumb {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  object-fit: cover; border-radius: 4px;
  border: 1px solid var(--stone-600); background: var(--stone-900); color: var(--text-faint);
}
.loot-thumb .icon, .loot-thumb svg { width: 22px; height: 22px; }
/* The picture box on the item dialog: click, drop, or paste anywhere in the dialog. */
.image-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px; text-align: center; cursor: pointer;
  border: 2px dashed var(--stone-500); border-radius: 6px;
  color: var(--text-dim); font-size: .9rem;
}
.image-drop .loot-image { margin: 0; }
.image-drop:hover, .image-drop.over { border-color: var(--gold-dim); color: var(--parchment); }
.image-drop:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.loot-image {
  display: block; max-width: 100%; max-height: 240px; margin: 0 auto 12px;
  border-radius: 6px; border: 1px solid var(--stone-600); background: var(--stone-900);
}
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.roster-table .btn-row { justify-content: flex-end; flex-wrap: nowrap; gap: 5px; }

/* Visually hidden, still read aloud - a column heading a screen reader needs
   and a sighted reader does not. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- the character sheet: a drawer over the list ---------------------------- */

.drawer-back {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(5,4,3,.62);
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(480px, 100%); height: 100%;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--stone-800), var(--stone-900));
  border-left: 1px solid var(--gold-dim);
  box-shadow: var(--shadow);
  animation: drawerin .22s ease;
}
@keyframes drawerin { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--stone-600);
  position: sticky; top: 0; z-index: 1;
  background: var(--stone-800);
}
.drawer-head h2 { margin: 0; font-size: 1.15rem; flex: 1; font-family: var(--font-display); color: var(--parchment); }
.drawer-body { padding: 16px 20px 32px; }
.drawer-sub { margin: 0 0 4px; font-size: .86rem; color: var(--text-faint); }
.drawer-sub strong { color: var(--parchment); }
.drawer-section { margin-top: 20px; }
.drawer-h {
  margin: 0 0 8px;
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold);
}
.drawer-attendance { display: grid; gap: 8px; }
.drawer-att-row { display: grid; grid-template-columns: 5.5em 1fr; align-items: center; gap: 10px; }
.drawer-att-label { font-size: .8rem; color: var(--text-faint); font-family: var(--font-mono); }

.unclaimed-note {
  border-left: 3px solid var(--warn);
  background: rgba(217,164,65,.07);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: .88rem;
}

/* ---- forums -------------------------------------------------------------- */

.board {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--stone-700);
}
.board:last-child { border-bottom: 0; }
.board:hover { background: rgba(201,162,39,.05); }
.board-icon { width: 30px; height: 30px; color: var(--gold-dim); flex: 0 0 auto; }
.board-body { flex: 1 1 auto; min-width: 0; }
.board-body h3 { margin: 0 0 2px; font-size: 1rem; }
.board-body p { margin: 0; font-size: .84rem; color: var(--text-faint); }
.board-stats { text-align: right; font-size: .78rem; color: var(--text-faint); white-space: nowrap; }

.thread-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid rgba(51,43,36,.5); }
.thread-row:hover { background: rgba(201,162,39,.05); }
.thread-title { font-weight: 600; color: var(--parchment); }
.thread-title a { color: inherit; }
.thread-meta { font-size: .77rem; color: var(--text-faint); }

/* The excerpt around a post-text match. Clamped to two lines so a result list
   stays a list: an unclamped 160-character snippet in a proportional font wraps
   to three or four lines on a phone and buries the titles between them. */
.search-excerpt {
  font-size: .8rem;
  color: var(--text-faint);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Submit-only, so the button is part of the control rather than an afterthought
   beside it. */
.forum-search { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.forum-search input { flex: 1 1 auto; min-width: 0; }

/* The pager reuses the .btn scale rather than inventing a link style, because
   its ends are SPANS - a disabled end must look like the live links it sits
   between and must not be clickable. */
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pager .is-disabled { opacity: .45; pointer-events: none; }
.pager-at { font-size: .78rem; color: var(--text-faint); padding: 0 6px; white-space: nowrap; }

.post {
  display: grid;
  grid-template-columns: 190px 1fr;
  border: 1px solid var(--stone-600);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  background: rgba(20,17,16,.6);
}
@media (max-width: 700px) { .post { grid-template-columns: 1fr; } }
.post-author {
  background: rgba(0,0,0,.35);
  border-right: 1px solid var(--stone-700);
  padding: 14px;
  text-align: center;
}
.post-author .who { font-family: var(--font-display); color: var(--parchment); font-size: .95rem; }
.post-author .toon { font-size: .78rem; color: var(--gold-dim); }
.post-body { padding: 14px 18px; }
.post-body > *:first-child { margin-top: 0; }
.post-body > *:last-child { margin-bottom: 0; }
.post-foot { font-size: .74rem; color: var(--text-faint); display: flex; gap: 10px; align-items: center; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--stone-700); }

/* ---- library ------------------------------------------------------------- */

.kind-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.page-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.page-card {
  display: block;
  padding: 15px 16px;
  border: 1px solid var(--stone-600);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(38,33,28,.7), rgba(18,15,13,.8));
  transition: border-color .15s, transform .15s;
}
.page-card:hover { border-color: var(--gold-dim); text-decoration: none; transform: translateY(-2px); }
.page-card h3 { margin: 0 0 5px; font-size: 1rem; }
.page-card p { margin: 0; font-size: .84rem; color: var(--text-dim); }
.page-card .tags { margin-top: 9px; display: flex; gap: 5px; flex-wrap: wrap; }

.prose { max-width: 74ch; }
.prose h2 { margin-top: 1.6em; padding-bottom: .2em; border-bottom: 1px solid var(--stone-700); }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .3em 0; }
.prose blockquote {
  margin: 1em 0; padding: .6em 1.1em;
  border-left: 3px solid var(--gold-dim);
  background: rgba(201,162,39,.06);
  color: var(--text-dim); font-style: italic;
}
.prose table { margin: 1em 0; }
.prose img { max-width: 100%; height: auto; }

/* ---- permission grid ----------------------------------------------------- */

.perm-module { border: 1px solid var(--stone-600); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.perm-module-head {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  background: rgba(0,0,0,.32);
  border-bottom: 1px solid var(--stone-700);
  flex-wrap: wrap;
}
.perm-module-head h3 { margin: 0; font-size: .95rem; }
.perm-module-head .desc { font-size: .8rem; color: var(--text-faint); flex: 1 1 100%; margin: 0; }
.perm-actions { display: grid; gap: 10px; padding: 13px 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.perm-action .help { font-size: .74rem; color: var(--text-faint); margin: 3px 0 0 47px; }

.role-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.role-card {
  border: 1px solid var(--stone-600);
  border-left: 3px solid var(--accent, var(--gold-dim));
  border-radius: var(--radius);
  padding: 13px 15px;
  background: rgba(20,17,16,.6);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.role-card:hover { background: rgba(201,162,39,.06); }
.role-card.on { border-color: var(--gold); background: rgba(201,162,39,.1); }
.role-card h3 { margin: 0 0 3px; font-size: 1rem; }
.role-card p { margin: 0; font-size: .8rem; color: var(--text-faint); }
.role-card .counts { margin-top: 8px; font-size: .74rem; color: var(--text-dim); display: flex; gap: 12px; }

/* ---- messages ------------------------------------------------------------ */

.alert { border-radius: var(--radius); padding: 11px 14px; margin-bottom: 16px; font-size: .89rem; border: 1px solid; }
.alert-error { background: rgba(184,67,47,.12); border-color: #6b2b20; color: #f0a494; }
.alert-ok { background: rgba(111,174,95,.12); border-color: #3e6135; color: #a9d69b; }
.alert-info { background: rgba(111,143,208,.1); border-color: #3c4a6b; color: #a8bde6; }
.alert-warn { background: rgba(217,164,65,.1); border-color: #6b551f; color: #e5c483; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-faint); }
.empty svg { width: 54px; height: 54px; opacity: .3; margin-bottom: 12px; }

.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--stone-800);
  border: 1px solid var(--gold-dim);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: .88rem;
  box-shadow: var(--shadow);
  animation: slidein .25s ease;
  max-width: 340px;
}
.toast.err { border-color: var(--blood); color: #f0a494; }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }

/* ---- modal --------------------------------------------------------------- */

.modal-back {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(5,4,3,.78);
  display: grid; place-items: center;
  padding: 20px;
  overflow-y: auto;
}
.modal {
  background: linear-gradient(180deg, var(--stone-800), var(--stone-900));
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(620px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--stone-600);
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0;
  background: var(--stone-800);
  z-index: 1;
}
.modal-head h2 { margin: 0; font-size: 1.1rem; flex: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--stone-600);
  display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0;
  background: var(--stone-800);
}

/* ---- sign in ------------------------------------------------------------- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 30px 20px; }
.gate-card { width: min(430px, 100%); }
.gate-crest { width: 92px; height: 92px; color: var(--gold); margin: 0 auto 14px; display: block; }
.gate h1 { text-align: center; font-size: 1.5rem; }
.gate .tagline { text-align: center; color: var(--text-faint); font-style: italic; margin: -6px 0 22px; }
.gate-switch { text-align: center; margin-top: 16px; font-size: .87rem; color: var(--text-faint); }

/* ---- misc ---------------------------------------------------------------- */

.stat-row { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 6px; }
.stat .n { font-family: var(--font-display); font-size: 1.6rem; color: var(--gold-bright); display: block; line-height: 1.1; }
.stat .k { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }

.muted { color: var(--text-faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.grow { flex: 1 1 auto; }
.small { font-size: .82rem; }

.readonly-banner {
  display: flex; align-items: center; gap: 10px;
  border: 1px dashed var(--stone-500);
  border-radius: var(--radius);
  padding: 9px 14px;
  margin-bottom: 18px;
  font-size: .84rem;
  color: var(--text-faint);
}
.readonly-banner svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .6; }

@media (max-width: 560px) {
  .panel { border-width: 16px; border-image-width: 16px; padding: 4px 10px 12px; }
  main { padding: 20px 14px 60px; }
  .masthead-inner { padding: 12px 14px; gap: 12px; }
  .crest { width: 44px; height: 44px; }
  .nav-inner { padding: 0 14px; }
  .nav a { padding: 11px 12px; font-size: .74rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.nav .sigil-art .mark, .panel-icon { opacity: 1; }

/* sigils used as small headings inside the flag editor */
.modal-body h3 > svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .8; }
