/* ============================================================
   Brand-specific overrides for image assets (logo + class crests).
   Loaded AFTER components.css so it can override the gradient mark
   and the monospace glyph fallback.
   ============================================================ */

/* ---- Header brand mark: image instead of gradient "R" ---- */
.site-header__brand .mark--logo {
  background: transparent;
  box-shadow: none;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
}
.site-header__brand .mark--logo::after { content: none; }
.site-header__brand .mark--logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* ---- Class chip: image crest instead of monospace glyph ---- */
.class-chip--img .cls__crest {
  width: var(--crest-size, 20px);
  height: var(--crest-size, 20px);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: transparent;
}
.class-chip--img .cls__crest img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
/* Slightly inflate the chip padding so the image doesn't crowd the label. */
.cls.class-chip--img {
  padding-left: 3px;
  padding-right: 8px;
  height: 24px;
  gap: 6px;
}
.cls.class-chip--img > span:not(.cls__crest) {
  font-size: 11px;
  line-height: 1;
}

/* Light theme: drop a subtle background ring to keep the bright crests legible. */
:root[data-theme="light"] .class-chip--img .cls__crest {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 4px;
}

/* ---- Role badge chevron (admin "view as" affordance) ----
   Signals "click to switch role". Rotates 180° when popover is open so it
   reads as a typical dropdown caret. */
.role-badge__chevron {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  opacity: 0.7;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast);
}
.role-badge:hover .role-badge__chevron { opacity: 1; }
.role-badge-wrap.is-open .role-badge__chevron { transform: rotate(180deg); }

/* ---- Extra-large avatar for the profile page ----
   Design system tops out at 48px (avatar--lg). The profile hero needs a
   bigger surface to breathe. */
.avatar--xl { width: 96px; height: 96px; font-size: 32px; border-radius: 16px; }

/* ---- Profile field grid: consistent label + value alignment ----
   Mixed content (chip badge vs plain text) used to leave the baseline
   uneven. Fixed min-height on each value box keeps the row gridded. */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-4);
}
.profile-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.profile-field__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.profile-field__value {
  display: flex;
  align-items: center;
  min-height: 28px;
  color: var(--text-hi);
  font-size: 15px;
  font-weight: 600;
}
.profile-field__value.is-mono { font-family: var(--font-mono); font-size: 18px; }
.profile-field__value.is-meta { font-size: 12px; color: var(--text-mid); font-weight: 400; }

/* ---- Representative-character hero card ----
   Layered design:
     1. ::before via `.profile-rep__bg` — same portrait as background, blurred
        + dimmed so it reads as atmosphere, not detail.
     2. ::after gradient mask — fades the BG into the page bg-base on the
        right + bottom so foreground text never battles a busy spot.
     3. Foreground (z-index >= 1) — head row + body grid.
   When there's no portrait (`has-portrait` absent) the BG layer collapses
   and the card looks like a regular bordered card. */
/* `.profile-rep` (AION rep char) and `.profile-hero` (Discord account)
   share the same hero shape — blurred portrait BG + foreground content.
   `.profile-rep.has-portrait` gets cyan tint; `.profile-hero.has-portrait`
   gets violet (Discord brand) tint to differentiate at a glance.
   Note: `overflow: hidden` is NOT on the card itself — it's on the
   `.profile-rep__bg` clipping wrapper. That way the blurred portrait
   stays bounded but child popovers (ⓘ tooltips) can escape the card. */
.profile-rep, .profile-hero {
  position: relative;
  isolation: isolate;
  border-radius: var(--r);
  padding: var(--s-6);
  margin-bottom: var(--s-4);
  border: 1px solid var(--line);
  background: var(--bg-raised);
}
.profile-rep.has-portrait {
  border-color: rgba(94, 226, 245, 0.22);
  box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.55);
}
.profile-hero.has-portrait {
  border-color: rgba(139, 126, 255, 0.28);
  box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.55);
}
.profile-hero .profile-rep__portrait {
  border-color: rgba(139, 126, 255, 0.32);
  background:
    radial-gradient(closest-side, rgba(139,126,255,0.16), transparent 70%),
    var(--bg-inset);
}
/* Clipping wrapper — bounds both the blurred portrait + the gradient
   overlay to the card's rounded rect. Self-clips with `overflow: hidden`
   so the parent card stays `overflow: visible` (lets popovers escape).
   `pointer-events: none` keeps it from intercepting clicks. */
.profile-rep__bg {
  position: absolute; inset: 0;
  border-radius: inherit;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.profile-rep__bg::before {
  /* Blurred portrait fill. Scaled up so the blur halo doesn't expose hard
     edges at the wrapper boundary. */
  content: "";
  position: absolute; inset: 0;
  background-image: var(--profile-portrait-url);
  background-size: cover;
  background-position: center 30%;
  filter: blur(28px) brightness(0.55) saturate(1.1);
  transform: scale(1.18);
  opacity: 0.75;
}
.profile-rep__bg::after {
  /* Vignette / fade — keeps the bottom-right portion legible for stats. */
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg,
      rgba(11, 13, 26, 0.05) 0%,
      rgba(11, 13, 26, 0.55) 70%,
      var(--bg-raised) 100%),
    linear-gradient(90deg,
      rgba(11, 13, 26, 0.10) 0%,
      rgba(11, 13, 26, 0.40) 50%,
      rgba(11, 13, 26, 0.65) 100%);
}
.profile-rep > *:not(.profile-rep__bg) { position: relative; z-index: 1; }

/* Head row — title + sync action cluster. Reuses .card__head but with the
   inline-padding-zero rule it picks up. */
.profile-rep__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
.profile-rep__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: var(--s-2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.profile-rep__head-actions {
  display: inline-flex; align-items: center; gap: var(--s-2);
}

/* Body — portrait (left) + info (right). On narrow screens the portrait
   drops above the info. */
.profile-rep__body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--s-6);
  align-items: center;
}
.profile-rep__portrait {
  position: relative;
  width: 220px; aspect-ratio: 1 / 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background:
    radial-gradient(closest-side, rgba(94,226,245,0.14), transparent 70%),
    var(--bg-inset);
  border: 1px solid rgba(94, 226, 245, 0.28);
  box-shadow:
    0 12px 32px -10px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(94, 226, 245, 0.05) inset;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.profile-rep__portrait img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 30%;  /* keep face in frame */
}
.profile-rep__portrait-fallback {
  font-size: 72px; font-weight: 800;
  color: var(--text-mid);
  letter-spacing: -0.02em;
}
.profile-rep__portrait img + .profile-rep__portrait-fallback { display: none; }
.profile-rep__portrait.is-fallback .profile-rep__portrait-fallback { display: inline; }

/* Info column — name + sub + stats stacked with consistent rhythm. */
.profile-rep__info {
  display: flex; flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}
.profile-rep__name-row {
  display: flex; align-items: center; gap: var(--s-3);
  flex-wrap: wrap;
}
.profile-rep__name {
  font-size: 28px; font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.profile-rep__chips {
  display: inline-flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.profile-rep__sub {
  font-size: 13px; color: var(--text-hi);
  opacity: 0.82;  /* 살짝만 가라앉혀서 이름(28px white) 와 위계 차이 유지 */
  letter-spacing: 0.02em;
  margin-top: -4px;
}
.profile-rep__stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px var(--s-5);
  align-items: baseline;
  padding-top: var(--s-3);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.profile-rep__stat {
  display: contents;  /* let stat-label + stat-value participate in parent grid */
}
.profile-rep__stat-label {
  font-size: 11px;
  color: var(--text-hi);
  opacity: 0.7;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.profile-rep__stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-hi);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}
.profile-rep__stat-value--time {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-hi);
  font-family: inherit;
  display: inline-flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
}
.profile-rep__stat-time-iso {
  font-size: 10px;
  color: var(--text-hi);
  opacity: 0.55;
  letter-spacing: 0;
}

.profile-rep__empty {
  padding: var(--s-6) var(--s-4);
  text-align: center;
  color: var(--text-mid);
}
.profile-rep__empty .empty__title { color: var(--text-hi); margin-top: 8px; }
.profile-rep__empty .empty__msg { font-size: 13px; margin-top: 4px; }

@media (max-width: 720px) {
  .profile-rep__body {
    grid-template-columns: 1fr;
    gap: var(--s-4);
    text-align: center;
  }
  .profile-rep__portrait {
    width: 160px; margin: 0 auto;
  }
  .profile-rep__portrait-fallback { font-size: 56px; }
  .profile-rep__name-row { justify-content: center; }
  .profile-rep__sub { text-align: center; margin-top: 0; }
  .profile-rep__stats {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .profile-rep__name { font-size: 24px; }
}

/* ---- Notifications list ---- */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
}
.notif-item:last-child { border-bottom: none; }
.notif-item__form { display: contents; margin: 0; }
.notif-item__icon {
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-inset);
  margin-top: 2px;
}
.notif-item__main {
  background: transparent;
  border: none;
  text-align: left;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  padding: 0;
}
.notif-item__actions {
  display: flex; gap: 4px;
  flex-shrink: 0; align-self: center;
  opacity: 0; transition: opacity var(--dur-fast);
}
.notif-item:hover .notif-item__actions,
.notif-item:focus-within .notif-item__actions { opacity: 1; }
.notif-item__action-form { display: contents; margin: 0; }
.notif-item__action {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-mid);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.notif-item__action:hover {
  color: var(--accent-violet);
  border-color: var(--line-accent);
  background: var(--bg-elevated);
}
.notif-item__action--danger:hover {
  color: var(--danger);
  border-color: rgba(242,109,109,0.4);
}
@media (max-width: 720px) {
  .notif-item__actions { opacity: 1; }
}
.notif-item__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-hi);
  display: flex;
  align-items: center;
  gap: 8px;
}
.notif-item__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.notif-item__body {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.5;
}
.notif-item__meta {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
}
.notif-item.is-unread { background: rgba(139, 126, 255, 0.04); }
.notif-item:hover { background: var(--bg-inset); }

/* Read items stay visible in the history view (/app/notifications) but
   fade so unread ones still pop. Title/body/meta dim together; the row
   keeps its hover state for usability. */
.notif-item.is-read { opacity: 0.55; }
.notif-item.is-read:hover { opacity: 0.85; background: var(--bg-inset); }
.notif-item.is-read .notif-item__title { font-weight: 500; }

/* Admin: cancelled notifications are crossed out + faded. */
.notif-item.is-cancelled { opacity: 0.5; }
.notif-item.is-cancelled .notif-item__title { text-decoration: line-through; }

/* ---- Notification bell + unread badge ----
   The bell shares `.theme-toggle` styling which sets `overflow: hidden`
   (for the sun/moon cross-fade). That clips the badge that extends past
   the button — explicitly override here.

   Hidden-attribute fix: `.notif-bell__badge` declares `display:
   inline-flex`, which has equal specificity to the UA's `[hidden] {
   display: none }` rule. Equal specificity → last-declared wins → our
   class wins → the badge stays visible even when we set `hidden=""`.
   The override below restores the standard semantic so the SSR /
   JS toggle of the `hidden` attribute actually works. */
.notif-bell__badge[hidden] { display: none !important; }
.notif-bell { position: relative; overflow: visible !important; }
.notif-bell__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #0B0D1A;
  background: var(--danger);
  border-radius: 8px;
  box-shadow: 0 0 0 2px var(--bg-base);
  pointer-events: none;
  z-index: 1;
}

/* ---- Active state for usermenu (profile link) ---- */
.usermenu.is-active {
  background: var(--accent-grad-soft);
  border-color: var(--line-accent);
  color: var(--text-hi);
}

/* ---- Header right cluster: align role badge / preview button / theme toggle to 32px ----
   The role badge defaults to ~22px from the design system; bump it inside the
   header so all three controls form a clean visual row. */
.site-header__right {
  align-items: center;
  gap: var(--s-2);
}
.site-header__right .role-badge,
.site-header__right .badge {
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  border-radius: var(--r-sm);
}
.site-header__right .role-badge .role-badge__plus {
  padding: 2px 6px;
}

/* ---- Theme toggle: cross-fade between sun/moon ----
   Both icons rendered; the active one fades in with a small rotation. JS
   adds `.is-light` to `.theme-toggle` when light theme is active. */
.theme-toggle {
  position: relative;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: var(--text-mid);
  background: var(--bg-raised);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
  overflow: hidden;
}
.theme-toggle:hover {
  color: var(--text-hi);
  border-color: var(--line-strong);
  background: var(--bg-elevated);
}
.theme-toggle__icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
/* Default (dark theme): show sun (action: switch to light) */
.theme-toggle .theme-toggle__sun  { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .theme-toggle__moon { opacity: 0; transform: rotate(60deg) scale(0.7); }
/* Light theme: swap */
.theme-toggle.is-light .theme-toggle__sun  { opacity: 0; transform: rotate(-60deg) scale(0.7); }
.theme-toggle.is-light .theme-toggle__moon { opacity: 1; transform: rotate(0deg) scale(1); color: var(--accent-violet); }

/* ---- Role popover button items (admin preview) ---- */
.role-popover__item-form { display: block; }
.role-popover__item-form + .role-popover__item-form { border-top: 1px dashed var(--line); }
.role-popover__item--btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.role-popover__item--btn:hover {
  background: var(--bg-inset);
}
.role-popover__item--btn.is-primary {
  background: var(--accent-grad-soft);
}
.role-popover__item--btn .role-popover__body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.role-popover__item--btn .role-popover__label { display: flex; align-items: center; gap: 8px; }
.role-popover__item--btn .role-popover__desc { color: var(--text-mid); }

/* ---- KPI value digit rendering ----
   JetBrains Mono ships with slashed-zero as its default 0 glyph. At 32px /
   weight 600 the slash makes the digit look hollow / outlined. Disable the
   `zero` OpenType feature so 0 renders as a normal solid oval. Tabular nums
   (`tnum`) stay on for column alignment. */
.kpi__value,
.kpi__value .mono {
  font-feature-settings: 'zero' 0, 'tnum' 1;
  font-variant-numeric: tabular-nums;
}

/* ---- Primary button text fix ----
   Design CSS overlays the gradient via `::before` and lifts only ELEMENT
   children (`> *`) above it. Text nodes have no box so they couldn't be
   z-indexed and ended up hidden behind the gradient. We drop the pseudo and
   paint the gradient directly on the button — text now reads correctly. */
.btn--primary {
  background: var(--accent-grad) !important;
  color: #0B0D1A !important;
}
.btn--primary::before { content: none !important; }

/* ---- Toggle button groups (weekdays / hours) ----
   Hidden checkbox + styled label. Multi-select via name="weekdays"/"hours".
   Server reads via form.getlist(). */
.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.toggle-group .toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-inset);
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all var(--dur-fast) var(--ease);
}
.toggle-group .toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.toggle-group .toggle:hover {
  color: var(--text-hi);
  border-color: var(--line-strong);
}
.toggle-group .toggle:has(input:checked) {
  background: var(--accent-grad-soft);
  border-color: var(--line-accent);
  color: var(--text-hi);
  box-shadow: 0 0 0 1px var(--line-accent) inset;
}
.toggle-group--hours .toggle {
  min-width: 40px;
  padding: 0 6px;
  font-family: var(--font-mono);
}
/* Day-of-week chips: weekend tinting for visual cue */
.toggle-group--weekdays .toggle:nth-child(6):has(input:checked) { /* 토 */
  border-color: rgba(94, 226, 245, 0.5);
  color: var(--accent-cyan);
}
.toggle-group--weekdays .toggle:nth-child(7):has(input:checked) { /* 일 */
  border-color: rgba(255, 122, 89, 0.5);
  color: var(--cls-dps);
}

/* ---- Settings tabs ----
   Server renders all 4 panels; this CSS hides the inactive ones. JS in the
   page swaps `.is-active`. */
.settings-panel { display: none; }
.settings-panel.is-active { display: block; }
.settings-tabs { flex-wrap: wrap; gap: var(--s-2); border-bottom: 1px solid var(--line); }

/* ---- Mobile tabbar column variants (admin / member with 시공) ---- */
.mobile-tabbar__inner--5 { grid-template-columns: repeat(5, 1fr) !important; }
.mobile-tabbar__inner--6 { grid-template-columns: repeat(6, 1fr) !important; }
/* Squeeze the label/icon a hair for 6 columns so each cell still has
   enough breathing room on a 360-px-wide phone. */
.mobile-tabbar__inner--6 a { padding: 8px 2px; font-size: 10px; }
.mobile-tabbar__inner--6 a span { font-size: 10px; }
.mobile-tabbar__inner--6 a svg { width: 18px; height: 18px; }

/* ---- Re-verification badge ---- */
.badge--reverify {
  background: rgba(232, 178, 74, 0.15);
  color: var(--warn);
  border: 1px solid rgba(232, 178, 74, 0.4);
}
.badge--reverify .dot {
  background: var(--warn);
  box-shadow: 0 0 6px var(--warn);
}

/* ---- Members table mobile cards ----
   Under 768px the table collapses into stacked cards: each <tr> becomes a
   panel and each <td> a label/value row driven by the data-label attribute.
   Avoids horizontal scroll while showing every column. */
@media (max-width: 768px) {
  .members-table thead { display: none; }
  .members-table,
  .members-table tbody { display: block; width: 100%; }
  .table-wrap { overflow: visible; background: transparent; border: none; }

  .members-table tr {
    display: block;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: var(--s-3);
    padding: var(--s-3) var(--s-4);
  }
  .members-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-3);
    padding: 6px 0;
    border: none;
    min-width: 0;
    width: auto;
    text-align: right;
  }
  .members-table td::before {
    content: attr(data-label);
    color: var(--text-mid);
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
  }
  .members-table td.cell-member,
  .members-table td.cell-actions {
    justify-content: flex-start;
    padding: 4px 0;
  }
  .members-table td.cell-member {
    border-bottom: 1px dashed var(--line);
    margin-bottom: 6px;
    padding-bottom: 10px;
  }
  .members-table td.cell-member::before,
  .members-table td.cell-actions::before { content: none; }
  .members-table td.cell-actions {
    border-top: 1px dashed var(--line);
    margin-top: 6px;
    padding-top: 10px;
    justify-content: flex-end;
  }
  /* Push the actual class chip / legion badge to the right side */
  .members-table td .cls,
  .members-table td .legion,
  .members-table td .role-badge-wrap {
    margin-left: auto;
  }
}

/* ---- Members table nick cell ----
   The design CSS targets `td.nick-cell`, but our markup wraps the cell with
   `<td><div class="nick-cell">`. Mirror the flex layout here so avatar +
   name sit on the same row. */
.members-table td .nick-cell {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.members-table td .nick-cell .name {
  font-weight: 600;
  color: var(--text-hi);
  font-size: 13px;
  line-height: 1.2;
}

/* ---- Avatar image (Discord profile) ----
   The .avatar wrapper sets the size + circular shape via the design system;
   we just need the image to fill it. */
.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

/* ---- Role popover toggle ----
   The reference React app conditionally mounted the popover; in SSR we render
   it always, so we need an explicit hidden default. The JS in role-popover.js
   toggles `.is-open` on the wrapper. */
.role-popover { display: none; }
.role-badge-wrap.is-open .role-popover { display: block; }
.role-badge--multi { cursor: pointer; }

/* ---- Owned character list (profile page) ---- */
.character-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.character-list__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.character-list__item.is-rep {
  background: var(--accent-grad-soft);
  border-color: var(--line-accent);
}
.character-list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.character-list__name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.character-list__meta { font-size: 11px; }
.character-list__actions { flex-shrink: 0; }

.badge--accent {
  background: var(--accent-grad);
  color: var(--bg-base, #0B0D1A);
  font-weight: 700;
  border: none;
}

/* ---- Artisan / Artifact War shared tokens (theme-aware outcome colors) ---- */
:root {
  --ar-win-fg:    #5DD29F;
  --ar-win-strong:#3FBE85;
  --ar-win-soft:  rgba(93, 210, 159, 0.12);
  --ar-win-line:  rgba(93, 210, 159, 0.40);
  --ar-win-text:  #B8F0D6;

  --ar-lose-fg:   #F26D6D;
  --ar-lose-strong:#D85454;
  --ar-lose-soft: rgba(242, 109, 109, 0.12);
  --ar-lose-line: rgba(242, 109, 109, 0.40);
  --ar-lose-text: #FFC9C9;

  --ar-tie-fg:    #E8B24A;
  --ar-tie-strong:#D19A2A;
  --ar-tie-soft:  rgba(232, 178, 74, 0.12);
  --ar-tie-line:  rgba(232, 178, 74, 0.40);
  --ar-tie-text:  #FFE0A8;

  --ar-neutral-fg:   var(--text-mid);
  --ar-neutral-soft: rgba(148, 163, 220, 0.10);
  --ar-neutral-line: var(--line);

  /* Faction palette */
  --ar-east-fg: #5EB6FF;     --ar-east-soft: rgba(94,182,255,0.12);  --ar-east-line: rgba(94,182,255,0.40);
  --ar-west-fg: #E89B5E;     --ar-west-soft: rgba(232,155,94,0.12);  --ar-west-line: rgba(232,155,94,0.40);
}
:root[data-theme="light"] {
  --ar-win-fg:    #1F8C56;  --ar-win-soft:  rgba(31, 140, 86, 0.10);  --ar-win-line:  rgba(31, 140, 86, 0.30);
  --ar-lose-fg:   #C03A3A;  --ar-lose-soft: rgba(192, 58, 58, 0.08);  --ar-lose-line: rgba(192, 58, 58, 0.28);
  --ar-tie-fg:    #8C6510;  --ar-tie-soft:  rgba(140, 101, 16, 0.10); --ar-tie-line:  rgba(140, 101, 16, 0.28);
  --ar-neutral-soft: rgba(45, 49, 82, 0.05);
  --ar-east-fg: #1466B8;    --ar-east-soft: rgba(20,102,184,0.08);   --ar-east-line: rgba(20,102,184,0.30);
  --ar-west-fg: #A05A14;    --ar-west-soft: rgba(160,90,20,0.10);    --ar-west-line: rgba(160,90,20,0.30);
}

/* ============================================================
   Artisan / Artifact War card system — shared across the artifact-war
   listing page (artisan.html) and the per-event detail page
   (artifact_war_detail.html). Tokens live above; this section is layout.
   ============================================================ */

/* Faction chips (동부/서부) */
.ar-faction-vs--east { --fac-fg: var(--ar-east-fg); --fac-soft: var(--ar-east-soft); --fac-line: var(--ar-east-line); }
.ar-faction-vs--west { --fac-fg: var(--ar-west-fg); --fac-soft: var(--ar-west-soft); --fac-line: var(--ar-west-line); }
.ar-faction-vs {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.08em; font-weight: 700;
}
.ar-faction-vs__mine,
.ar-faction-vs__enemy {
  padding: 3px 10px; border-radius: 999px;
  color: var(--fac-fg); background: var(--fac-soft);
  border: 1px solid var(--fac-line);
}
.ar-faction-vs__sep { color: var(--text-dim); font-size: 12px; padding: 0 2px; }
.ar-faction-tag {
  display: inline-block; padding: 1px 6px; margin-right: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--fac-fg); background: var(--fac-soft);
  border: 1px solid var(--fac-line); border-radius: 4px;
  vertical-align: baseline;
}
.ar-roster__side-tag {
  display: inline-block; margin-left: 4px; padding: 0 4px;
  font-size: 9px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-dim); background: var(--bg-inset);
  border-radius: 3px;
}

/* Per-card outcome aliasing — the card swaps which family it consumes. */
.ar-card.is-win  { --ar-fg: var(--ar-win-fg);  --ar-strong: var(--ar-win-strong);  --ar-soft: var(--ar-win-soft);  --ar-line: var(--ar-win-line);  --ar-text: var(--ar-win-text); }
.ar-card.is-lose { --ar-fg: var(--ar-lose-fg); --ar-strong: var(--ar-lose-strong); --ar-soft: var(--ar-lose-soft); --ar-line: var(--ar-lose-line); --ar-text: var(--ar-lose-text); }
.ar-card.is-tie  { --ar-fg: var(--ar-tie-fg);  --ar-strong: var(--ar-tie-strong);  --ar-soft: var(--ar-tie-soft);  --ar-line: var(--ar-tie-line);  --ar-text: var(--ar-tie-text); }

/* Wrapper anchor — keeps the whole card clickable without changing layout. */
.ar-card-link {
  display: block; color: inherit; text-decoration: none;
  border-radius: var(--r-lg);
  transition: transform var(--dur-fast);
}
.ar-card-link:hover .ar-card { border-color: var(--line-strong); background: var(--bg-elevated); }
.ar-card-link:active { transform: scale(0.995); }
.ar-card-link:focus-visible { outline: 2px solid var(--accent-violet); outline-offset: 2px; }

.ar-card {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: var(--r-lg);
  padding: 24px 28px 24px 32px;
  overflow: hidden;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.ar-card__rail { position: absolute; top: 0; left: 0; bottom: 0; width: 4px; background: var(--ar-fg); }
.ar-card--featured { margin-bottom: 24px; }
.ar-card__head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 22px; flex-wrap: wrap;
}
.ar-card__pill {
  display: inline-flex; align-items: center; padding: 4px 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--ar-fg); background: var(--ar-soft);
  border: 1px solid var(--ar-line); border-radius: 999px;
}
.ar-card__date { font-size: 12px; color: var(--text-mid); }

.ar-headline {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 24px; margin-bottom: 24px;
}
.ar-seal {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  font-size: 32px; font-weight: 900; line-height: 1;
  background: var(--ar-fg); color: var(--bg-raised);
  border-radius: 12px;
  box-shadow: 0 8px 24px -10px var(--ar-fg);
  letter-spacing: 0.02em;
}
:root[data-theme="light"] .ar-seal { color: #FFFFFF; }

/* Scoreboard — symmetric flex layout: each side stacks `[number]` over its
   `[label]` and centers both. The colon sits dead-center between them.
   Easier to keep visually balanced than the prior grid approach. */
.ar-score {
  display: flex; align-items: center; justify-content: center;
  gap: 18px; min-width: 0;
}
.ar-score__side {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 56px;
}
.ar-score__num {
  font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -0.02em;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}
.ar-score__num--mine  { color: var(--ar-fg); }
.ar-score__num--enemy { color: var(--text-mid); font-size: 40px; font-weight: 600; }
.ar-card.is-lose .ar-score__num--mine  { color: var(--text-mid); font-size: 40px; font-weight: 600; }
.ar-card.is-lose .ar-score__num--enemy { color: var(--ar-fg); font-size: 56px; font-weight: 700; }
.ar-card.is-tie .ar-score__num--mine,
.ar-card.is-tie .ar-score__num--enemy { color: var(--ar-fg); font-size: 48px; font-weight: 700; }
.ar-score__sep {
  font-size: 32px; color: var(--text-dim); font-weight: 400; line-height: 1;
  align-self: flex-start; padding-top: 8px;
}
.ar-score__label {
  font-size: 11px; font-weight: 600; color: var(--text-mid);
  letter-spacing: 0.04em;
}
.ar-score__label--mine  { color: var(--accent-cyan); }
.ar-score__label--enemy { color: var(--text-mid); }
:root[data-theme="light"] .ar-score__label--mine { color: #0891A8; }

/* Matchup chip — "루드라 VS {enemy}" displayed in the result card header */
.ar-matchup {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.ar-matchup__mine  { color: var(--accent-cyan); font-size: 12px; }
.ar-matchup__sep   { font-size: 9px; color: var(--text-dim); letter-spacing: 0.12em; padding: 0 2px; }
.ar-matchup__enemy { color: var(--ar-lose-fg); font-size: 12px; }
:root[data-theme="light"] .ar-matchup__mine  { color: #0891A8; }
:root[data-theme="light"] .ar-matchup__enemy { color: #C03A3A; }

.ar-headline__tail {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 16px; min-width: 84px;
  background: var(--ar-soft); border: 1px solid var(--ar-line);
  border-radius: var(--r-md);
}
.ar-delta { font-size: 22px; font-weight: 700; color: var(--ar-fg); line-height: 1;
  font-feature-settings: 'tnum' 1, 'lnum' 1; }
.ar-delta--tie { font-size: 14px; letter-spacing: 0.12em; }
.ar-delta__label { font-size: 9px; color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase; }

.ar-divider {
  height: 1px; margin: 0 -28px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.ar-floors { display: flex; flex-direction: column; gap: 14px; margin: 22px 0; }
.ar-floor { display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: center; }
.ar-floor__label { font-size: 12px; font-weight: 600; color: var(--text-mid); letter-spacing: 0.04em; }
.ar-floor__bars { display: flex; flex-direction: column; gap: 6px; }
.ar-floor__bar {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 10px;
  background: var(--ar-neutral-soft); border-radius: 4px; overflow: hidden;
}
.ar-floor__bar--enemy { flex-direction: row-reverse; }
.ar-floor__fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  border-radius: 4px;
  transition: width 0.4s ease-out;
}
.ar-floor__fill--mine  { background: var(--ar-fg); opacity: 0.24; }
.ar-floor__fill--mine.is-winner  { opacity: 1; }
.ar-floor__fill--enemy { background: var(--text-mid); opacity: 0.20; }
.ar-floor__fill--enemy.is-winner { background: var(--ar-fg); opacity: 1; }
.ar-card.is-lose .ar-floor__fill--mine  { background: var(--text-mid); opacity: 0.20; }
.ar-card.is-lose .ar-floor__fill--mine.is-winner  { background: var(--text-mid); opacity: 1; }
.ar-card.is-lose .ar-floor__fill--enemy.is-winner { background: var(--ar-fg); opacity: 1; }
.ar-floor__num {
  position: relative; z-index: 1;
  font-size: 13px; font-weight: 700; color: var(--text-hi);
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}
.ar-floor__num.is-winner { color: var(--bg-raised); }
:root[data-theme="light"] .ar-floor__num.is-winner { color: #FFFFFF; }
/* In the new layout the bar holds [number] [region names] (or the mirror
   on enemy bars via row-reverse). Number sits at the bar's outer edge,
   region names stretch to fill the rest, ellipsing when too long. */
.ar-floor__bar-regions {
  position: relative; z-index: 1;
  flex: 1; min-width: 0;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: color-mix(in oklab, var(--text-hi) 65%, transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ar-floor__bar--mine  .ar-floor__bar-regions { text-align: left; }
.ar-floor__bar--enemy .ar-floor__bar-regions { text-align: right; }
/* Higher contrast when the bar's own side is the winner — readable on top
   of the saturated fill. */
.ar-floor__fill--mine.is-winner  ~ .ar-floor__bar-regions,
.ar-floor__bar--mine:has(.ar-floor__fill--mine.is-winner) .ar-floor__bar-regions,
.ar-floor__bar--enemy:has(.ar-floor__fill--enemy.is-winner) .ar-floor__bar-regions {
  color: var(--bg-raised);
}
:root[data-theme="light"] .ar-floor__bar:has(.is-winner) .ar-floor__bar-regions { color: #FFFFFF; }
.ar-floor__bar-regions--empty { color: var(--text-dim); font-weight: 500; opacity: 0.7; }

.ar-rosters { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.ar-roster { display: flex; align-items: center; gap: 12px; }
.ar-roster__side {
  flex-shrink: 0; min-width: 40px;
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  letter-spacing: 0.1em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 4px;
}
.ar-roster--mine .ar-roster__side  { color: var(--ar-fg); }
.ar-roster__servers { display: flex; gap: 6px; flex-wrap: wrap; min-height: 22px; align-items: center; }

.ar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px;
  contain: layout style; }
.ar-card--row { padding: 14px 18px 14px 22px; }
.ar-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) auto auto 1.4fr;
  gap: 16px; align-items: center;
}
.ar-row__when { display: flex; flex-direction: column; gap: 2px; }
.ar-row__date { font-size: 13px; font-weight: 600; color: var(--text-hi); }
.ar-row__day  { font-size: 10px; }
.ar-row__seal-wrap { display: flex; align-items: center; gap: 10px; }
.ar-row__seal {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  background: var(--ar-fg); color: var(--bg-raised);
  border-radius: 8px; font-weight: 800; font-size: 13px;
}
:root[data-theme="light"] .ar-row__seal { color: #FFFFFF; }
.ar-row__score {
  font-size: 16px; font-weight: 700; color: var(--text-hi); white-space: nowrap;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}
.ar-row__sep { color: var(--text-dim); padding: 0 2px; }
.ar-row__floors { display: flex; gap: 16px; align-items: center; }
.ar-row__floor { display: inline-flex; align-items: baseline; gap: 5px; }
.ar-row__floor-name { font-size: 10px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.04em; }
.ar-row__floor-num { font-size: 14px; font-weight: 700; color: var(--text-mid);
  font-feature-settings: 'tnum' 1, 'lnum' 1; }
.ar-row__floor-num.is-up   { color: var(--ar-win-fg); }
.ar-row__floor-num.is-down { color: var(--ar-lose-fg); }
.ar-row__floor-vs { font-size: 11px; margin-left: 2px; color: var(--text-dim); font-weight: 500; }
.ar-row__servers {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 11px; justify-content: flex-end; align-items: center;
}
.ar-row__servers-vs { color: var(--text-dim); padding: 0 2px; }

@media (max-width: 760px) {
  .ar-card { padding: 18px 20px 18px 24px; }
  .ar-card--featured { padding: 20px 20px 20px 24px; }
  .ar-divider { margin: 0 -20px; }
  .ar-headline { grid-template-columns: auto 1fr; gap: 16px; }
  .ar-headline__tail {
    grid-column: 1 / -1;
    flex-direction: row; gap: 8px; padding: 8px 12px;
    align-items: baseline; justify-content: center;
  }
  .ar-seal { width: 56px; height: 56px; font-size: 26px; }
  .ar-score__mine,
  .ar-card.is-lose .ar-score__enemy { font-size: 42px; }
  .ar-score__enemy,
  .ar-card.is-lose .ar-score__mine { font-size: 32px; }
  .ar-card.is-tie .ar-score__mine,
  .ar-card.is-tie .ar-score__enemy { font-size: 36px; }
  .ar-floor { grid-template-columns: 38px 1fr; gap: 10px; }
  .ar-row { grid-template-columns: 1fr; gap: 8px; }
  .ar-row__servers { justify-content: flex-start; }
}

/* ---- Faction toggle (admin result form) — live `:has(:checked)` feedback
   + per-faction color tint so 동부/서부 visually pop their own color when
   selected. The server-side `.is-active` class still works as a fallback. */
.faction-toggle__btn { position: relative; }
.faction-toggle__btn--east  { --fac-fg: var(--ar-east-fg); --fac-soft: var(--ar-east-soft); --fac-line: var(--ar-east-line); }
.faction-toggle__btn--west  { --fac-fg: var(--ar-west-fg); --fac-soft: var(--ar-west-soft); --fac-line: var(--ar-west-line); }
.faction-toggle--colored .faction-toggle__btn:has(input:checked),
.faction-toggle--colored .faction-toggle__btn.is-active {
  color: var(--fac-fg);
  background: var(--fac-soft);
  border-color: var(--fac-line);
  box-shadow:
    0 0 0 1px var(--fac-line) inset,
    0 4px 18px -8px var(--fac-fg);
}
.faction-toggle--colored .faction-toggle__btn:has(input:checked)::after,
.faction-toggle--colored .faction-toggle__btn.is-active::after {
  content: "✓"; position: absolute; top: 6px; right: 8px;
  font-size: 11px; color: var(--fac-fg); opacity: 0.85;
  font-family: 'JetBrains Mono', monospace;
}
.faction-toggle--colored .faction-toggle__btn:hover {
  background: color-mix(in oklab, var(--fac-fg, var(--text-mid)) 10%, var(--bg-elevated));
}

/* ---- Sortable table headers (members) ---- */
.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.sort-link:hover { color: var(--text-hi); }
.sort-link.is-active { color: var(--accent-violet); font-weight: 600; }

/* ---- Avatar dropdown menu (header right rail) ----
   Single trigger that collapses role switcher / theme / profile / logout
   into one menu so the header stays clean. Notif bell stays outside this
   menu — its red dot needs at-a-glance visibility. */
.user-menu-wrap { position: relative; display: inline-block; }
.usermenu__chev {
  font-size: 10px; color: var(--text-dim);
  margin-left: 2px;
  transition: transform var(--dur-fast);
}
.usermenu[aria-expanded="true"] .usermenu__chev {
  transform: rotate(180deg); color: var(--accent-violet);
}
.user-menu {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  min-width: 240px; max-width: calc(100vw - 16px);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0,0,0,0.4));
  z-index: 100;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.user-menu[hidden] { display: none !important; }

.user-menu__head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}
.user-menu__avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%; overflow: hidden;
  background: var(--accent-grad);
  display: grid; place-items: center;
  color: #0B0D1A; font-size: 14px; font-weight: 700;
  border: 1px solid var(--line);
}
.user-menu__avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-menu__id { min-width: 0; flex: 1; }
.user-menu__name { font-size: 13px; font-weight: 700; color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu__handle { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.user-menu__section {
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.user-menu__section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-dim); text-transform: uppercase;
}

.user-menu__divider { height: 1px; background: var(--line); margin: 0; }

.user-menu__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: transparent; border: none;
  color: var(--text-mid);
  font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer; text-align: left;
  width: 100%;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.user-menu__item:hover {
  background: var(--bg-inset);
  color: var(--text-hi);
}
.user-menu__item--danger { color: var(--danger); }
.user-menu__item--danger:hover { background: rgba(255,93,143,0.08); color: var(--danger); }

/* Theme-toggle inside the user menu.
   The header bell variant uses absolute positioning so the sun/moon can
   crossfade in place inside a 32×32 square — but inside our flat menu row
   that breaks the layout (icons float to position 0,0 of the row, and the
   "테마 전환" label wraps to a new line). Reset to inline flow + show only
   the icon representing the *target* theme (sun in light mode = "switch
   to dark"). */
.user-menu__item .theme-toggle__icon {
  position: static;
  inset: auto;
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 14px; height: 14px;
  flex-shrink: 0;
  opacity: 1; transform: none;
}
[data-theme="light"] .user-menu__item .theme-toggle__sun,
.user-menu__item .theme-toggle__moon { display: none !important; }
[data-theme="light"] .user-menu__item .theme-toggle__moon,
.user-menu__item .theme-toggle__sun { display: inline-flex !important; }

/* ---- Notification popover (header bell) + inline detail modal (Task #11) ---- */
.notif-bell-wrap { position: relative; display: inline-block; }
.notif-popover {
  position: fixed;
  width: min(360px, calc(100vw - 16px));
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0,0,0,0.4));
  z-index: 100;
  overflow: hidden;
}
.notif-popover[hidden] { display: none !important; }
.notif-popover__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}
.notif-popover__title { font-size: 12px; font-weight: 700; color: var(--text-hi); letter-spacing: 0.04em; }
.notif-popover__actions { display: flex; gap: 12px; }
.notif-popover__link {
  background: none; border: none; padding: 0;
  font-size: 11px; color: var(--accent-violet); cursor: pointer;
  text-decoration: none;
}
.notif-popover__link:hover { color: var(--text-hi); }
.notif-popover__list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.notif-popover__loading,
.notif-popover__empty {
  padding: 24px 12px; text-align: center; color: var(--text-mid); font-size: 12px;
}
.notif-popover__item {
  display: flex; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.notif-popover__item:last-child { border-bottom: none; }
.notif-popover__item:hover,
.notif-popover__item:focus { background: var(--bg-inset); outline: none; }
.notif-popover__item.is-unread { background: rgba(139, 126, 255, 0.06); }
.notif-popover__item.is-unread:hover { background: rgba(139, 126, 255, 0.10); }
.notif-popover__glyph {
  flex-shrink: 0; width: 18px; text-align: center;
  font-size: 14px; line-height: 18px; padding-top: 2px;
}
.notif-popover__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.notif-popover__main .notif-popover__title {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  font-weight: 500; color: var(--text-hi); letter-spacing: normal;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-popover__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-violet); flex-shrink: 0;
}
.notif-popover__body {
  font-size: 12px; color: var(--text-mid);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-popover__meta { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--text-dim); }
.notif-popover__main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
}
.notif-popover__actions {
  display: flex; gap: 4px; flex-shrink: 0; align-self: center;
  opacity: 0; transition: opacity var(--dur-fast);
}
.notif-popover__item:hover .notif-popover__actions,
.notif-popover__item:focus-within .notif-popover__actions { opacity: 1; }
@media (max-width: 720px) { .notif-popover__actions { opacity: 1; } }
.notif-popover__action {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-mid);
  font-size: 11px; line-height: 1; cursor: pointer;
  transition: all var(--dur-fast);
}
.notif-popover__action:hover {
  color: var(--accent-violet);
  border-color: var(--line-accent);
  background: var(--bg-elevated);
}
.notif-popover__action--danger:hover {
  color: var(--danger);
  border-color: rgba(242,109,109,0.4);
}

/* Notification detail dialog */
.notif-modal {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 0;
  background: var(--bg-elevated);
  color: var(--text-hi);
  max-width: min(560px, 92vw);
  width: 100%;
}
.notif-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.notif-modal__inner { display: flex; flex-direction: column; gap: 0; }
.notif-modal__head {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}
.notif-modal__icon {
  flex-shrink: 0; width: 28px; height: 28px;
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace; font-size: 18px; line-height: 1;
}
.notif-modal__head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.notif-modal__title { font-size: 16px; font-weight: 700; color: var(--text-hi); }
.notif-modal__meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-dim); }
.notif-modal__close {
  background: none; border: none; color: var(--text-mid); font-size: 24px; line-height: 1;
  cursor: pointer; padding: 4px 8px; border-radius: var(--r-sm);
}
.notif-modal__close:hover { color: var(--text-hi); background: var(--bg-inset); }
.notif-modal__body {
  padding: 16px 20px; min-height: 80px;
  font-size: 14px; line-height: 1.6; color: var(--text-mid);
  white-space: pre-wrap;
}
.notif-modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-raised);
}
