/* =================================================================
   AVIEL'S CLOSED AGENCY ARCHIVE — style.css
   Black-and-red sci-fi thriller aesthetic: HUD terminal, neon red
   grid, glitching display type, scanning beam, angular brackets.
   Sections:
     1. Tokens & reset
     2. Atmosphere (grid, scan beam, particles, scanlines, grain, glow)
     3. Classification bar & session control
     4. Buttons
     5. Hero (+ typing title, glitch)
     6. Admin panel
     7. Toolbar / search
     8. Records & ledger tables
     9. Inline edit fields
    10. Footer
    11. Mute button
    12. Modals
    13. Reveal animations
    14. Responsive
    15. Reduced motion & focus
   ================================================================= */

/* ---------- 1. TOKENS & RESET ---------- */
:root {
  --bg:            #000000;
  --bg-raised:     #0a0505;
  --panel:         rgba(8, 5, 5, 0.72);
  --panel-solid:   #0c0808;
  --red:           #ff1a2e;
  --red-dim:       #9c0014;
  --red-deep:      #5c0009;
  --red-glow:      rgba(255, 26, 46, 0.55);
  --grid-line:     rgba(255, 26, 46, 0.09);
  --gray-line:     rgba(255, 255, 255, 0.08);
  --gray-line-2:   rgba(255, 255, 255, 0.15);
  --text:          #f1eeee;
  --text-soft:     #a99b9b;
  --text-faint:    #6c5c5c;

  --display: 'Orbitron', 'Rajdhani', 'Segoe UI', Arial, sans-serif;
  --sans:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', 'Courier New', monospace;

  --radius:    4px;
  --radius-sm: 3px;
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --shell-max: 1180px;
}

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

/* [hidden] must always win: several components (e.g. .btn) set their own
   `display`, which has the same specificity as the browser's built-in
   `[hidden] { display: none }` rule — without this, "hidden" elements like
   the admin-only Add Entry button can still render. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; }

::selection { background: var(--red); color: #000; }

/* Thin themed scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--red), var(--red-deep));
  border-radius: 20px;
  border: 2px solid #000;
}
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ---------- 2. ATMOSPHERE ---------- */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* HUD grid: faint red graph lines across the whole viewport */
.atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.55;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
}

/* Drifting red glow clouds — kept minimal so the grid reads through */
.fog {
  position: absolute;
  width: 140vmax;
  height: 140vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  mix-blend-mode: screen;
}
.fog--1 {
  top: -40vmax; left: -30vmax;
  background: radial-gradient(circle at 50% 50%, rgba(120, 4, 10, 0.4), transparent 60%);
  animation: fog-drift-1 46s linear infinite;
}
.fog--2 {
  bottom: -50vmax; right: -35vmax;
  background: radial-gradient(circle at 50% 50%, rgba(60, 2, 6, 0.42), transparent 62%);
  animation: fog-drift-2 62s linear infinite;
}
.fog--3 {
  top: 10vmax; right: -20vmax;
  background: radial-gradient(circle at 50% 50%, rgba(140, 6, 12, 0.2), transparent 58%);
  animation: fog-drift-3 78s linear infinite;
}
@keyframes fog-drift-1 {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(12vmax, 8vmax) scale(1.12); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes fog-drift-2 {
  0%   { transform: translate(0, 0) scale(1.05); }
  50%  { transform: translate(-14vmax, -6vmax) scale(1); }
  100% { transform: translate(0, 0) scale(1.05); }
}
@keyframes fog-drift-3 {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-9vmax, 10vmax) scale(1.15); }
  100% { transform: translate(0, 0) scale(1); }
}

/* Central ambient red glow — very subtle */
.ambient-glow {
  position: absolute;
  top: 30%; left: 50%;
  width: 60vmax; height: 60vmax;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(140, 4, 10, 0.18), transparent 60%);
  animation: pulse-glow 9s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.95; }
}

/* Scanning beam — a thin red line that sweeps top to bottom like a system scan */
.scan-beam {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red) 20%, #fff 50%, var(--red) 80%, transparent);
  box-shadow: 0 0 18px 2px var(--red-glow);
  opacity: 0.55;
  animation: scan-sweep 7s linear infinite;
}
@keyframes scan-sweep {
  0%   { top: -2%; opacity: 0; }
  8%   { opacity: 0.6; }
  92%  { opacity: 0.6; }
  100% { top: 102%; opacity: 0; }
}

/* Floating particles (each .particle injected by JS) — small red data-bits */
.particles { position: absolute; inset: 0; }
.particle {
  position: absolute;
  bottom: -12px;
  width: 3px; height: 3px;
  border-radius: 1px;
  background: var(--red);
  box-shadow: 0 0 7px 1px var(--red-glow);
  animation-name: float-up;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  opacity: 0;
}
@keyframes float-up {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.7; }
  100% { transform: translateY(-104vh) translateX(var(--drift, 20px)); opacity: 0; }
}

/* CRT scanlines */
.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
}

/* Film grain flicker */
.grain {
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.04;
  animation: grain-shift 0.6s steps(2) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(-6%, 4%); }
}

/* Corner vignette */
.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.88) 100%);
}

/* ---------- 3. CLASSIFICATION BAR & SESSION ---------- */
.classbar {
  position: relative;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: linear-gradient(90deg, #0e0000, #000 40%, #000 60%, #0e0000);
  border-bottom: 1px solid rgba(255, 26, 46, 0.28);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.classbar__mark {
  color: #000;
  background: var(--red);
  padding: 0.15rem 0.55rem;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  letter-spacing: 0.14em;
  font-weight: 700;
  box-shadow: 0 0 12px var(--red-glow);
}
.classbar__sep { color: var(--red); }
.classbar__code { color: var(--text-soft); }
.classbar__code::before { content: "NODE://"; color: var(--red-dim); }

.session-control {
  position: fixed;
  top: 2.6rem;
  right: 1.25rem;
  z-index: 30;
}

/* ---------- 4. BUTTONS ---------- */
.btn {
  --btn-bg: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--gray-line-2);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  background: var(--btn-bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
              border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.btn__icon { font-size: 0.95em; line-height: 1; }
.btn--sm { padding: 0.5rem 0.85rem; font-size: 0.7rem; }

.btn--ghost {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn--ghost:hover {
  border-color: var(--red);
  box-shadow: 0 0 18px rgba(255, 26, 46, 0.35);
  transform: translateY(-2px);
}

.btn--solid {
  background: linear-gradient(180deg, var(--red), var(--red-dim));
  border-color: var(--red);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 0 rgba(255, 26, 46, 0.0);
}
.btn--solid:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(255, 26, 46, 0.45), 0 0 18px var(--red-glow);
}

.btn--danger {
  background: linear-gradient(180deg, #ff2b2b, #5c0009);
  border-color: #ff5050;
  color: #fff;
}
.btn--danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(255, 30, 30, 0.55);
}

.btn:active { transform: translateY(0); }

/* ---------- 5. HERO ---------- */
.hero {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92vh;
  padding: 5rem 1.5rem 4rem;
  text-align: center;
}
.hero__inner { max-width: 900px; }

.hero__eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 1.5rem;
}

.hero__title {
  position: relative;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.9rem, 6.6vw, 5rem);
  line-height: 1.08;
  letter-spacing: 0.03em;
  margin: 0;
  color: #fff;
  text-shadow:
    0 0 22px rgba(255, 26, 46, 0.5),
    0 0 60px rgba(140, 4, 10, 0.4);
}
.hero__typed { display: inline; }

/* Glitch flicker: red/white ghost layers occasionally slice sideways */
.hero__title::before,
.hero__title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.hero__title::before {
  color: var(--red);
  animation: glitch-a 6.5s steps(1) infinite;
  clip-path: inset(0 0 60% 0);
}
.hero__title::after {
  color: #fff;
  animation: glitch-b 6.5s steps(1) infinite;
  clip-path: inset(60% 0 0 0);
}
@keyframes glitch-a {
  0%, 92%, 100% { opacity: 0; transform: translate(0, 0); }
  93%  { opacity: 0.7; transform: translate(-3px, 1px); }
  94%  { opacity: 0.5; transform: translate(2px, -1px); }
  95%  { opacity: 0; }
}
@keyframes glitch-b {
  0%, 90%, 100% { opacity: 0; transform: translate(0, 0); }
  91%  { opacity: 0.6; transform: translate(3px, -1px); }
  92%  { opacity: 0.4; transform: translate(-2px, 1px); }
  93%  { opacity: 0; }
}

.hero__sub {
  max-width: 620px;
  margin: 1.75rem auto 0;
  color: var(--text-soft);
  font-size: clamp(0.95rem, 1.7vw, 1.1rem);
  font-weight: 300;
}

/* STATUS toggle — restyled as a bracketed HUD switch rather than a stamp */
.hero__stamp {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin-top: 2.4rem;
  padding: 0.85rem 2.4rem;
  border: 1px solid rgba(255, 26, 46, 0.55);
  background: rgba(140, 4, 10, 0.08);
  color: var(--red);
  cursor: pointer;
  box-shadow: inset 0 0 20px rgba(140, 4, 10, 0.25);
  transition: box-shadow 0.35s var(--ease), border-color 0.4s var(--ease),
              color 0.4s var(--ease), background 0.4s var(--ease), transform 0.25s var(--ease);
}
/* Corner brackets — classic HUD framing */
.hero__stamp::before,
.hero__stamp::after {
  content: "";
  position: absolute;
  top: -6px; bottom: -6px;
  width: 14px;
  border: 1px solid currentColor;
  opacity: 0.85;
}
.hero__stamp::before { left: -6px; border-right: none; border-bottom: none; border-top: 1px solid currentColor; }
.hero__stamp::after  { right: -6px; border-left: none; }
.hero__stamp:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 0 22px rgba(140, 4, 10, 0.3), 0 0 26px var(--red-glow);
}
.hero__stamp:active { transform: translateY(-1px); }

/* Opened state: brighter neon red rather than green */
.hero__stamp.is-open {
  border-color: var(--red);
  color: #fff;
  background: rgba(255, 26, 46, 0.16);
  box-shadow: inset 0 0 22px rgba(255, 26, 46, 0.3), 0 0 26px var(--red-glow);
}
.hero__stamp.is-open:hover {
  box-shadow: inset 0 0 24px rgba(255, 26, 46, 0.36), 0 0 32px var(--red-glow);
}

.hero__stamp-line {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.34em;
  opacity: 0.85;
}
.hero__stamp-word {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.22em;
  line-height: 1;
}

/* ---------- 6. ADMIN PANEL ---------- */
.admin-panel {
  position: fixed;
  top: 6.5rem;
  right: 1.25rem;
  z-index: 25;
  width: 240px;
  padding: 1.1rem;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 26, 46, 0.4);
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%, 0 12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 26px rgba(140, 4, 10, 0.25);
  animation: panel-in 0.4s var(--ease);
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.admin-panel__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.admin-panel__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse { 50% { opacity: 0.35; } }
.admin-panel__title {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: #fff;
}
.admin-panel__hint {
  margin: 0 0 0.9rem;
  font-size: 0.72rem;
  color: var(--text-soft);
  line-height: 1.45;
}
.admin-panel__actions { display: flex; flex-direction: column; gap: 0.5rem; }
.admin-panel__actions .btn { justify-content: center; width: 100%; }
.admin-panel__migrate { justify-content: center; width: 100%; margin-top: 0.5rem; }
.admin-panel__saved {
  margin: 0.7rem 0 0;
  min-height: 1em;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--red);
  text-align: center;
  transition: color 0.2s ease;
}
.admin-panel__saved.is-error { color: #ffb347; }

.admin-panel__cloud {
  margin: 0.6rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 26, 46, 0.18);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--text-soft);
}
.admin-panel__cloud.is-live::before {
  content: "\25CF ";
  color: #3ddc84;
}
.admin-panel__cloud.is-local::before {
  content: "\25CF ";
  color: #ffb347;
}

/* ---------- 7. TOOLBAR / SEARCH ---------- */
.toolbar {
  position: relative;
  z-index: 2;
  padding: 1rem 1.5rem 0;
}
.toolbar__inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.search {
  position: relative;
  flex: 1 1 340px;
  display: flex;
  align-items: center;
}
.search__icon {
  position: absolute;
  left: 1rem;
  color: var(--red);
  font-size: 1rem;
  pointer-events: none;
}
.search__input {
  width: 100%;
  padding: 0.9rem 2.6rem;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--gray-line-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.search__input::placeholder { color: var(--text-faint); }
.search__input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 26, 46, 0.18), 0 0 22px rgba(140, 4, 10, 0.3);
}
.search__input::-webkit-search-cancel-button { display: none; }
.search__clear {
  position: absolute;
  right: 0.85rem;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.search__clear:hover { background: var(--red); color: #000; }
.toolbar__hint {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- 8. RECORDS & LEDGER ---------- */
.records {
  position: relative;
  z-index: 2;
  max-width: var(--shell-max);
  margin: 3.5rem auto 0;
  padding: 0 1.5rem;
}
.records__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.records__title-wrap { display: flex; flex-direction: column; gap: 0.35rem; }
.records__index {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--red);
}
.records__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.4rem, 3.2vw, 2.2rem);
  letter-spacing: 0.03em;
  color: var(--text);
  text-shadow: 0 0 20px rgba(140, 4, 10, 0.3);
}

/* Table shell — HUD panel with corner brackets. The frame itself never
   scrolls, so the corner brackets stay pinned to its corners on every
   device; only .table-scroll (the table's own box) scrolls internally,
   both horizontally (narrow/mobile screens) and vertically (tall
   tables), independent of the page's own scroll. */
.table-shell {
  position: relative;
  border: 1px solid rgba(255, 26, 46, 0.32);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 30px rgba(140, 4, 10, 0.2), inset 0 0 40px rgba(0, 0, 0, 0.5);
}
.table-scroll {
  /* Own scroll region: enables a genuinely sticky header AND horizontal
     scroll on mobile. Short tables simply don't scroll and flow normally. */
  overflow: auto;
  max-height: 82vh;
  -webkit-overflow-scrolling: touch;
  border-radius: inherit;
}
.table-shell::before,
.table-shell::after {
  content: "";
  position: absolute;
  top: -1px;
  width: 22px; height: 22px;
  border-top: 2px solid var(--red);
  pointer-events: none;
  z-index: 4;
}
.table-shell::before { left: -1px; border-left: 2px solid var(--red); }
.table-shell::after   { right: -1px; border-right: 2px solid var(--red); }

.ledger {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

/* Sticky header */
.ledger thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 1rem 1.1rem;
  text-align: left;
  background: linear-gradient(180deg, #150001, #0a0000);
  border-bottom: 1px solid rgba(255, 26, 46, 0.45);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
  white-space: nowrap;
}
.col-no { width: 62px; text-align: center !important; color: var(--red) !important; }
.col-www { width: 84px; text-align: center !important; }
.col-actions { width: 150px; text-align: center !important; }

.sortable { cursor: pointer; user-select: none; transition: color 0.2s; }
.sortable:hover { color: #fff; }
.sort-ind {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.7em;
  color: var(--red);
  opacity: 0;
  transition: opacity 0.2s;
}
.sortable.sorted-asc .sort-ind,
.sortable.sorted-desc .sort-ind { opacity: 1; }
.sortable.sorted-asc .sort-ind::after  { content: "\25B2"; }
.sortable.sorted-desc .sort-ind::after { content: "\25BC"; }

/* Body cells */
.ledger tbody td {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--gray-line);
  color: var(--text);
  vertical-align: middle;
}
.ledger tbody tr:last-child td { border-bottom: none; }
.cell-no {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--red);
}
.cell-name { font-weight: 500; }
.cell-face { color: var(--text-soft); }
.cell-agency {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
}

/* ---------- WWW (picture) column ---------- */
.cell-www { text-align: center; }
.cell-www-empty {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-faint);
}
.www-thumb-btn {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}
.cell-www-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--gray-line-2);
  border-radius: var(--radius-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.www-thumb-btn:hover .cell-www-thumb,
.www-thumb-btn:focus-visible .cell-www-thumb {
  border-color: var(--red);
  box-shadow: 0 0 14px var(--red-glow);
  transform: scale(1.08);
}

/* Inline uploader shown while a row is being edited */
.www-editor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.cell-www-thumb--edit { cursor: default; }
.www-upload-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--gray-line-2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.www-upload-btn:hover { color: #fff; border-color: var(--red); box-shadow: 0 0 10px var(--red-glow); }
.www-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--gray-line-2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.www-remove-btn:hover { color: #fff; border-color: #ff5050; background: rgba(255, 30, 30, 0.2); }

/* Zebra striping */
.ledger tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }

/* Row hover: lift + red wash */
.ledger tbody tr {
  transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.ledger tbody tr:hover {
  background: rgba(140, 4, 10, 0.18);
  box-shadow: inset 3px 0 0 var(--red), 0 0 22px rgba(140, 4, 10, 0.22);
}

/* Row action buttons (admin) */
.row-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--gray-line-2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.icon-btn:hover { color: #fff; transform: translateY(-1px); }
.icon-btn--edit:hover   { border-color: var(--red); box-shadow: 0 0 12px var(--red-glow); }
.icon-btn--del:hover    { border-color: #ff5050; background: rgba(255, 30, 30, 0.2); }
.icon-btn--save:hover   { border-color: #fff; background: rgba(255, 26, 46, 0.18); box-shadow: 0 0 12px var(--red-glow); }
.icon-btn--cancel:hover { border-color: var(--gray-line-2); background: rgba(255, 255, 255, 0.06); }

.empty-note {
  margin: 0;
  padding: 2.2rem 1rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

/* Row being edited */
.ledger tbody tr.is-editing { background: rgba(140, 4, 10, 0.14); }
.ledger tbody tr.is-editing:hover { box-shadow: inset 3px 0 0 #fff; }

/* ---------- 9. INLINE EDIT FIELDS ---------- */
.cell-input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  background: #0a0505;
  border: 1px solid var(--gray-line-2);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cell-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(255, 26, 46, 0.22);
}

/* ---------- 10. FOOTER ---------- */
.site-footer {
  position: relative;
  z-index: 2;
  margin-top: 5rem;
  padding: 3rem 1.5rem 3.5rem;
  text-align: center;
}
.site-footer__rule {
  width: 60px;
  height: 1px;
  margin: 0 auto 1.6rem;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}
.site-footer__text {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--text-soft);
  opacity: 0.65;
}
.site-footer__meta {
  margin: 0.7rem 0 0;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  opacity: 0.55;
}

/* ---------- 11. MUTE BUTTON ---------- */
.mute-btn {
  position: fixed;
  bottom: 1.35rem;
  right: 1.35rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 26, 46, 0.4);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--mono);
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6), 0 0 18px rgba(140, 4, 10, 0.25);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.mute-btn:hover {
  transform: translateY(-2px);
  border-color: var(--red);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 24px var(--red-glow);
}
.mute-btn__icon { font-size: 1.05rem; line-height: 1; }
.mute-btn__label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.mute-btn.is-playing { border-color: var(--red); box-shadow: 0 8px 26px rgba(0,0,0,0.6), 0 0 20px var(--red-glow); }

/* ---------- 12. MODALS ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}
.modal.is-open { opacity: 1; visibility: visible; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 2.4rem 2rem 2rem;
  background: linear-gradient(180deg, #100708, #050202);
  border: 1px solid rgba(255, 26, 46, 0.5);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.8), 0 0 40px rgba(140, 4, 10, 0.3);
  text-align: center;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.35s var(--ease);
}
.modal.is-open .modal__dialog { transform: translateY(0) scale(1); }
.modal__dialog--sm { max-width: 380px; }
.modal__dialog--image { max-width: 520px; padding: 2.4rem 1.4rem 1.4rem; }
.modal__image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
  border: 1px solid var(--gray-line-2);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 30px rgba(140, 4, 10, 0.25);
}

.modal__close {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.4rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.modal__close:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.modal__seal {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
  filter: drop-shadow(0 0 12px var(--red-glow));
}
.modal__seal--danger { filter: drop-shadow(0 0 12px rgba(255, 30, 30, 0.6)); }

.modal__title {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.03em;
  color: #fff;
}
.modal__subtitle {
  margin: 0 0 1.6rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.field { text-align: left; margin-bottom: 1.1rem; }
.field__label {
  display: block;
  margin-bottom: 0.4rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.field__input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  background: #070303;
  border: 1px solid var(--gray-line-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field__input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 26, 46, 0.2);
}

.modal__error {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: #ff4d4d;
}
.modal__actions {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  margin-top: 0.6rem;
}
.modal__actions .btn { flex: 1; justify-content: center; }

/* ---------- 13. REVEAL ANIMATIONS ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Admin-only cells hidden by default; toggled on via body class */
.admin-only { display: none; }
body.is-admin .admin-only { display: table-cell; }

/* ---------- 14. RESPONSIVE ---------- */
@media (max-width: 720px) {
  .classbar { font-size: 0.56rem; letter-spacing: 0.1em; gap: 0.35rem; padding: 0.5rem 0.7rem; }
  .classbar__text { display: none; }

  .session-control { top: 2.2rem; right: 0.9rem; }
  .session-control .btn span:last-child { display: none; }
  .session-control .btn { padding: 0.6rem; }

  .admin-panel {
    top: auto;
    bottom: 5.8rem;
    right: 0.9rem;
    left: 0.9rem;
    width: auto;
  }
  .admin-panel__actions { flex-direction: row; }

  .hero { min-height: 84vh; padding-top: 4rem; }
  .toolbar__hint { display: none; }

  .records { margin-top: 2.6rem; }
  .records__head { flex-direction: column; align-items: flex-start; }

  .mute-btn__label { display: none; }
  .mute-btn { padding: 0.7rem; }

  .modal__actions { flex-direction: column; }
}

@media (max-width: 420px) {
  .hero__stamp-word { font-size: 1.25rem; letter-spacing: 0.16em; }
}

/* ---------- 15. REDUCED MOTION & FOCUS ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .particle { display: none; }
  .scan-beam { display: none; }
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 2px;
}
