@view-transition {
  navigation: auto;
}

:root {
  --ink: #14112c;
  --panel: #1a1740;
  --panel-alt: #201c4c;
  --line: #362f66;
  --brass: #b8923f;
  --brass-bright: #d9b563;
  --accent: #6d5dd3;
  --accent-bright: #ab9cff;
  --moss: #6fbf9a;
  --rust: #e08585;
  --text: #ece8f6;
  --text-dim: #948abd;
  --radius: 4px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
}

::selection {
  background: var(--accent);
  color: var(--ink);
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background-color: var(--panel);
  background-image: radial-gradient(rgba(171, 156, 255, 0.12) 1px, transparent 1px);
  background-size: 24px 24px;
  border-right: 1px solid var(--line);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 20px;
}

.brand-name {
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.03em;
  color: var(--text);
}

.brand-rule {
  width: 36px;
  height: 2px;
  background: var(--brass);
  margin-bottom: 18px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-right: -10px;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

.nav a {
  text-decoration: none;
  color: var(--text-dim);
  padding: 9px 10px;
  border-radius: var(--radius);
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-left: 2px solid transparent;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--panel-alt);
  border-left-color: var(--line);
}

.nav a.active {
  color: var(--brass-bright);
  background: var(--panel-alt);
  border-left-color: var(--brass);
}

.nav-divider {
  margin: 18px 0 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.6;
  padding: 0 10px;
}

.ledger-note {
  flex-shrink: 0;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--line);
  padding-top: 16px;
  line-height: 1.5;
}

[data-guest-only],
[data-player-only],
[data-staff-only],
[data-coowner-only],
[data-developer-only],
[data-feature] {
  display: none;
}

.account-box {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.account-name {
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-box a {
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.18s ease;
}

.account-box a:hover {
  color: var(--brass-bright);
}

.account-box .btn {
  width: 100%;
  justify-content: center;
}

.main {
  flex-grow: 1;
  padding: 40px 48px;
  max-width: 980px;
  view-transition-name: main-view;
}

.main.view-enter {
  animation: fadeInUp 0.3s ease backwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

::view-transition-image-pair(main-view) {
  overflow: visible;
}

::view-transition-old(main-view),
::view-transition-new(main-view) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  mix-blend-mode: normal;
}

:root[data-slide-dir="down"]::view-transition-old(main-view) {
  animation-name: lv-slide-out-up;
}
:root[data-slide-dir="down"]::view-transition-new(main-view) {
  animation-name: lv-slide-in-bottom;
}
:root[data-slide-dir="up"]::view-transition-old(main-view) {
  animation-name: lv-slide-out-down;
}
:root[data-slide-dir="up"]::view-transition-new(main-view) {
  animation-name: lv-slide-in-top;
}

@keyframes lv-slide-in-bottom {
  from { transform: translateY(36px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes lv-slide-out-up {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-36px); opacity: 0; }
}
@keyframes lv-slide-in-top {
  from { transform: translateY(-36px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes lv-slide-out-down {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(36px); opacity: 0; }
}

.flash-stack {
  margin-bottom: 20px;
}

.flash {
  background: rgba(224, 133, 133, 0.12);
  border: 1px solid var(--rust);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 8px;
  animation: fadeInUp 0.3s ease both;
}

h1 {
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 8px;
}

h2 {
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
  color: var(--brass-bright);
  margin: 0 0 14px;
}

.subhead {
  font-family: Georgia, serif;
  font-style: italic;
  color: var(--text-dim);
  margin: 0 0 32px;
  font-size: 15px;
}

.body-copy {
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 32px;
}

.body-copy p {
  margin: 0 0 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  animation: fadeInUp 0.45s ease backwards;
}

.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }

.stat-card:hover {
  border-color: var(--brass);
  box-shadow: 0 0 0 1px rgba(184, 146, 63, 0.3);
}

.stat-number {
  font-family: "IBM Plex Mono", monospace;
  font-size: 30px;
  font-weight: 600;
  color: var(--brass-bright);
  display: block;
}

.stat-label {
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin-top: 4px;
  display: block;
}

.action-row {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 1px solid var(--brass);
  color: var(--ink);
  background: var(--brass);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.25s ease, transform 0.08s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: var(--brass-bright);
  border-color: var(--brass-bright);
  box-shadow: 0 0 0 3px rgba(184, 146, 63, 0.18);
}

.btn:active {
  transform: scale(0.97);
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--brass);
  color: var(--brass-bright);
  background: transparent;
  box-shadow: none;
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--rust);
  color: var(--rust);
}

.empty.notice-danger {
  color: var(--rust);
}

.btn-danger:hover {
  background: rgba(224, 133, 133, 0.12);
  border-color: var(--rust);
  box-shadow: none;
}

.ledger {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.ledger-row {
  display: grid;
  grid-template-columns: 90px 1fr 140px 160px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  gap: 12px;
  transition: background-color 0.18s ease;
}

.ledger-row:last-child {
  border-bottom: none;
}

.ledger-row:not(.head):hover {
  background: var(--panel-alt);
}

.ledger-row.head {
  background: var(--panel-alt);
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 13px;
  color: var(--text-dim);
  padding: 10px 18px;
}

.ledger-id {
  font-family: "IBM Plex Mono", monospace;
  color: var(--text-dim);
  font-size: 13px;
}

.ledger-main {
  min-width: 0;
}

.ledger-title {
  font-weight: 600;
  color: var(--text);
  display: block;
}

.ledger-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 2px;
}

.stamp {
  backface-visibility: hidden;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1.5px solid currentColor;
  border-radius: var(--radius);
  padding: 4px 9px;
  display: inline-block;
  transform: rotate(-2deg);
  justify-self: start;
  transition: transform 0.15s ease;
}

.stamp-available { color: var(--moss); }
.stamp-loaned { color: var(--brass-bright); }
.stamp-missing { color: var(--rust); }
.stamp-retired { color: var(--text-dim); }
.stamp-open { color: var(--brass-bright); }
.stamp-in_progress { color: #7fa8e0; }
.stamp-resolved { color: var(--moss); }
.stamp-closed { color: var(--text-dim); }
.stamp-active { color: var(--brass-bright); }
.stamp-returned { color: var(--moss); }

.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-row a {
  text-decoration: none;
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 14px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: border-color 0.18s ease, color 0.18s ease;
}

.filter-row a:hover {
  border-color: var(--brass);
  color: var(--brass-bright);
}

.filter-row a.active {
  border-color: var(--accent);
  color: var(--accent-bright);
}

.form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 560px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  transition: border-color 0.18s ease;
}

.field textarea {
  resize: vertical;
  min-height: 100px;
}

.field textarea.tall {
  min-height: 260px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brass);
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 24px 0;
}

.message {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  animation: fadeInUp 0.3s ease both;
}

.message.staff {
  border-left: 3px solid var(--brass);
}

.message-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-family: "IBM Plex Mono", monospace;
  padding-right: 56px;
}

.message-actions {
  display: flex;
  gap: 14px;
  margin-top: 8px;
}

.msg-action {
  background: none;
  border: none;
  padding: 0;
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s ease;
}

.msg-action:hover {
  color: var(--brass-bright);
}

.msg-action-danger {
  color: var(--rust);
}

.msg-action-danger:hover {
  color: #f2a3a3;
}

.message-hover-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 2px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.message:hover .message-hover-actions,
.message:focus-within .message-hover-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.msg-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.msg-icon-btn:hover,
.msg-icon-btn:focus-visible {
  background: var(--panel);
  color: var(--brass-bright);
  outline: none;
}

.msg-icon-btn-danger:hover,
.msg-icon-btn-danger:focus-visible {
  color: var(--rust);
}

.edited-tag {
  font-style: italic;
  opacity: 0.75;
}

.message-meta .author-link,
.ledger-title .author-link {
  color: var(--text-dim);
  text-decoration: none;
  cursor: pointer;
}

.message-meta .author-link:hover,
.ledger-title .author-link:hover {
  color: var(--brass-bright);
  text-decoration: underline;
}

.msg-edit-form {
  margin-top: 4px;
}

.msg-edit-form textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  min-height: 60px;
  resize: vertical;
}

.msg-edit-form textarea:focus {
  outline: none;
  border-color: var(--brass);
}

.overlay-body h1 {
  font-size: 24px;
  margin-right: 28px;
}

.overlay-mod-section {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 20px;
}

.ticket-meta {
  display: flex;
  gap: 22px;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.ticket-meta strong {
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
}

.token-box {
  background: var(--panel-alt);
  border: 1px dashed var(--brass);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.token-box a {
  color: var(--brass-bright);
  word-break: break-all;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.checkbox-field input {
  margin-top: 4px;
  width: auto;
}

.checkbox-field label {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
}

.checkbox-field a {
  color: var(--brass-bright);
  text-decoration: underline;
}

.empty {
  color: var(--text-dim);
  font-size: 14px;
  padding: 24px 0;
  font-family: Georgia, serif;
  font-style: italic;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 26, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: modalFadeIn 0.16s ease both;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPanelIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: min(620px, 90vh);
  overflow-y: auto;
  background: var(--panel);
  background-image: radial-gradient(rgba(171, 156, 255, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 34px 32px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  animation: modalPanelIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-panel h1 {
  font-size: 24px;
  margin-right: 28px;
}

.modal-panel .subhead {
  margin-bottom: 26px;
}

.modal-panel .form-card {
  max-width: none;
  border: none;
  padding: 0;
  background: transparent;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  border-color: var(--brass);
  color: var(--brass-bright);
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 800px) {
  .modal-backdrop {
    padding: 14px;
    align-items: flex-end;
  }
  .modal-panel {
    max-width: none;
    width: 100%;
    max-height: 85vh;
    border-radius: 10px 10px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop,
  .modal-panel {
    animation: none;
  }
}

@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;
  }
}

@media (max-width: 800px) {
  .shell {
    flex-direction: column;
  }
  .topbar {
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    padding: 0 64px 0 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand {
    margin-bottom: 0;
  }
  .menu-toggle {
    display: flex;
  }
  .nav-backdrop {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    width: min(300px, 84vw);
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.28s;
    box-shadow: none;
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
    box-shadow: 18px 0 40px rgba(8, 6, 24, 0.5);
  }
  body.nav-open {
    overflow: hidden;
  }
  .main {
    padding: 28px 20px;
  }
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .ledger-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
.dd {
  position: relative;
  display: inline-block;
  min-width: 170px;
}

.field .dd {
  display: block;
  width: 100%;
}

.dd.grow {
  flex-grow: 1;
}

.dd select {
  display: none;
}

.dd-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease;
}

.dd-btn:hover,
.dd.open .dd-btn,
.dd-btn:focus-visible {
  border-color: var(--brass);
  outline: none;
}

.dd-chev {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--brass);
  border-bottom: 1.5px solid var(--brass);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.dd.open .dd-chev {
  transform: translateY(2px) rotate(-135deg);
}

.dd-menu {
  position: fixed;
  z-index: 300;
  margin: 0;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--brass);
  border-radius: var(--radius);
  box-shadow: 0 14px 30px rgba(8, 6, 24, 0.55);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.dd-search {
  display: none;
  width: 100%;
  margin: 2px 0 6px;
  padding: 8px 10px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  transition: border-color 0.18s ease;
}

.dd-search:focus {
  outline: none;
  border-color: var(--brass);
}

.dd-menu.searchable .dd-search {
  display: block;
}

.dd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}

.dd-hidden {
  display: none;
}

.dd-none {
  color: var(--text-dim);
  font-style: italic;
  cursor: default;
}

.dd-menu.up {
  border-top: 1px solid var(--line);
  border-bottom: 2px solid var(--brass);
  transform: translateY(6px);
}

.dd-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dd-opt {
  padding: 8px 10px;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.dd-opt.hl {
  background: var(--panel-alt);
  color: var(--text);
}

.dd-opt.sel {
  color: var(--brass-bright);
  border-left-color: var(--brass);
}

.field-hint {
  margin: 8px 0 0;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: var(--text-dim);
}

.field-hint:empty {
  display: none;
}

.loan-stat {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-dim);
}

.loan-stat strong {
  color: var(--text);
}

.loan-stat-count {
  font-family: "IBM Plex Mono", monospace;
  color: var(--brass-bright);
  font-weight: 600;
}

.loan-stat-items {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.loan-stat.warn {
  border-left-color: var(--rust);
}

.loan-stat.warn .loan-stat-count {
  color: var(--rust);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0 18px;
}

#settings-form h2:not(:first-child) {
  margin-top: 28px;
}

.field input[type="number"] {
  -moz-appearance: textfield;
}

.field-hint.error {
  color: var(--rust);
  font-style: normal;
}

.field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.search-input {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 0 18px;
  padding: 10px 12px 10px 38px;
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23948abd' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5L14 14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  transition: border-color 0.18s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--brass);
}

.ledger-row.items {
  grid-template-columns: 1fr 150px;
}

.ledger-row.tickets {
  grid-template-columns: 90px 1fr 160px;
}

.ledger-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.ledger-qty {
  display: flex;
  flex-direction: column;
}

.qty-number {
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--brass-bright);
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  font-family: "EB Garamond", Georgia, serif;
  font-variant: small-caps;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.18s ease;
}

.back-link:hover {
  color: var(--brass-bright);
}

.item-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.item-head h1 {
  margin-bottom: 4px;
}

.item-head .subhead {
  margin-bottom: 0;
}

.item-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  image-rendering: pixelated;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.item-tooltip {
  display: block;
  width: 100%;
  height: auto;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

@media (max-width: 800px) {
  .ledger-row.items,
  .ledger-row.tickets,
  .ledger-row.accounts {
    grid-template-columns: 1fr;
  }
  .account-action {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.empty a {
  color: var(--accent-bright);
}

.ledger-wrap {
  position: relative;
}

.ledger-wrap .ledger-row {
  border-bottom: 1px solid var(--line);
}

.row-hover-actions {
  position: absolute;
  top: 50%;
  right: 14px;
  display: flex;
  gap: 2px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(calc(-50% - 3px));
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.ledger-wrap:hover .row-hover-actions,
.ledger-wrap:focus-within .row-hover-actions {
  opacity: 1;
  transform: translateY(-50%);
  pointer-events: auto;
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ticket-delete {
  flex-shrink: 0;
  margin-top: 4px;
  border: 1px solid var(--line);
}

.confirm-panel {
  max-width: 420px;
}

.confirm-panel h1 {
  font-size: 22px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ledger-wrap:last-child .ledger-row {
  border-bottom: none;
}

.topbar,
.menu-toggle,
.nav-backdrop {
  display: none;
}

.menu-toggle {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 170;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.18s ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  border-color: var(--brass);
  outline: none;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--brass-bright);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

body.nav-open .menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.nav-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}

body.nav-open .menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(10, 8, 26, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

body.nav-open .nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 800px) {
  .topbar {
    display: flex;
  }
  .menu-toggle {
    display: flex;
  }
  .nav-backdrop {
    display: block;
  }
}

@media (hover: none) {
  .message-hover-actions {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .row-hover-actions {
    opacity: 1;
    transform: translateY(-50%);
    pointer-events: auto;
  }
}

.ledger-row.loans {
  grid-template-columns: 1fr 1fr 160px;
}

.ledger-name {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.inv-icon {
  position: relative;
  display: block;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  box-sizing: border-box;
}

.inv-icon img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.inv-icon.loading img {
  opacity: 0;
}

.inv-icon.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid var(--line);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: inv-spin 0.8s linear infinite;
}

@keyframes inv-spin {
  to { transform: rotate(360deg); }
}

.inv-controls {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.inv-controls .search-input {
  flex: 1 1 260px;
  margin: 0;
}

.ledger-row.accounts {
  grid-template-columns: 1fr 110px 120px 290px;
}

.ledger-row.accounts.with-discord {
  grid-template-columns: minmax(0, 1fr) 96px 170px 100px 240px;
}

.ledger-row.accounts.with-discord .ledger-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-row.accounts.with-discord .account-action {
  justify-content: flex-end;
  white-space: nowrap;
}

.discord-id-input {
  margin: 0;
  max-width: none;
  background-image: none;
  padding: 6px 10px;
  font-size: 13px;
  transition: border-color 0.3s ease;
}

.discord-id-input.saved {
  border-color: var(--brass-bright);
}

.account-action {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.temp-password {
  font-family: "IBM Plex Mono", monospace;
  font-size: 20px;
  letter-spacing: 0.08em;
  text-align: center;
  user-select: all;
  color: var(--text);
  margin-bottom: 20px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

h1 + .inv-controls {
  margin-top: 24px;
}

.team-section {
  margin-bottom: 34px;
}

.team-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.team-card {
  width: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.team-card:hover,
.team-card:focus-visible {
  border-color: var(--brass);
  transform: translateY(-2px);
}

.team-avatar {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  border-radius: 4px;
  background: var(--panel-alt);
}

.team-name {
  font-weight: 600;
  font-size: 15px;
  word-break: break-word;
  text-align: center;
}

.team-title {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

.team-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  margin-bottom: 8px;
  background: var(--panel-alt);
  border-radius: var(--radius);
}

.team-stage-note {
  color: var(--text-dim);
  font-size: 14px;
}

.team-canvas {
  display: block;
  max-width: 100%;
  cursor: grab;
}

.team-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.team-bio {
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}

.team-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.team-edit {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  margin-bottom: 14px;
  max-width: 760px;
}

.team-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 16px;
}

.team-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.release-list {
  max-width: 760px;
}

.release-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.release-info {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 800px) {
  .team-edit-grid {
    grid-template-columns: 1fr;
  }
  .team-card {
    width: calc(50% - 7px);
  }
}

.change-entry {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  max-width: 760px;
}

.change-entry h2 {
  margin: 8px 0 10px;
}

.change-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.change-body p {
  color: var(--text);
  line-height: 1.6;
  margin: 0 0 10px;
}

.change-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.change-images img {
  max-width: 100%;
  width: 220px;
  height: 140px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: zoom-in;
}

.change-full {
  display: block;
  max-width: 100%;
  border-radius: var(--radius);
}

.change-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.change-thumb {
  position: relative;
  width: 120px;
  height: 80px;
}

.change-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.change-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  line-height: 20px;
  padding: 0;
  background: rgba(16, 12, 36, 0.85);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
}

.change-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  max-width: 760px;
}

.change-row .release-info {
  flex: 1 1 auto;
}

.nav a {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.nav a.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

body.nav-sorting,
body.nav-sorting .nav a {
  cursor: grabbing;
}

.team-meta .stamp {
  transform: none;
}

.team-bio-edit {
  margin-top: 14px;
}

.team-bio-actions {
  display: flex;
  gap: 10px;
}

.team-bio-status {
  color: var(--rust);
  font-size: 13px;
  margin: 0 0 10px;
}

@media (max-width: 800px) {
  .ledger-row.accounts,
  .ledger-row.accounts.with-discord {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px;
  }
  .ledger-row.head.accounts {
    display: none;
  }
  .ledger-row.accounts .stamp {
    justify-self: start;
  }
  .ledger-row.accounts .account-action {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }
  .ledger-row.accounts .account-action:empty {
    display: none;
  }
}

.ledger-row.loans .stamp,
.ledger-row.loans .stamp:hover {
  transform: none;
}

a.discord-btn[data-feature] {
  display: none;
}

.discord-btn {
  flex-shrink: 0;
  margin-top: 14px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  background: #5865f2;
  color: #fff;
  border: 1px solid #5865f2;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.discord-btn:hover {
  background: #4752c4;
  border-color: #4752c4;
  color: #fff;
}

.discord-logo {
  width: auto;
  height: 20px;
  flex-shrink: 0;
}


.todo-form {
  display: flex;
  gap: 10px;
  margin: 18px 0 22px;
  max-width: 640px;
}

.todo-form .search-input {
  flex: 1;
  min-width: 0;
}

.todo-list {
  max-width: 640px;
  border-top: 1px solid var(--line);
}

.todo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.todo-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--brass-bright);
  cursor: pointer;
}

.todo-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.todo-text {
  overflow-wrap: anywhere;
}

.todo-row.is-done .todo-text {
  text-decoration: line-through;
  opacity: 0.55;
}

.todo-form .btn {
  align-self: flex-start;
  padding-top: 10px;
  padding-bottom: 10px;
}

.todo-comment-btn {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 2px 0;
  margin-top: 2px;
  color: var(--accent-bright);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.todo-comment-btn:hover {
  text-decoration: underline;
}

.todo-thread {
  margin: 0 0 12px 32px;
  padding: 10px 0 2px 14px;
  border-left: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.todo-comment {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.todo-comment-text {
  overflow-wrap: anywhere;
}

.todo-comment-form {
  display: flex;
  gap: 8px;
}

.todo-comment-form .search-input {
  flex: 1;
  min-width: 0;
}

.todo-comment-form .btn {
  align-self: flex-start;
}

.todo-item {
  border-bottom: 1px solid var(--line);
}

.todo-item .todo-row {
  border-bottom: none;
}

.armour-box {
  margin: -6px 0 18px 14px;
  padding: 4px 0 0 16px;
  border-left: 2px solid var(--line);
}

.armour-box .field {
  margin-bottom: 14px;
}

.armour-box .field-hint {
  margin: 0 0 12px;
}

/* Sections page */
.section-server-field {
  max-width: 240px;
  margin: 14px 0 20px;
}

.section-heading {
  margin-top: 32px;
}

.section-search {
  max-width: 640px;
  margin-bottom: 14px;
}

.section-detail-actions {
  margin: 14px 0 18px;
}

.section-list,
.section-items {
  max-width: 640px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.section-row,
.section-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.18s ease;
}

.section-list .ledger-wrap:last-child .section-row,
.section-items > .section-item-row:last-child {
  border-bottom: none;
}

.section-row {
  cursor: pointer;
  padding-right: 96px;
}

.section-row:hover,
.section-row:focus-visible,
.section-item-row:hover {
  background: var(--panel-alt);
  outline: none;
}

.section-row:hover .ledger-title,
.section-row:focus-visible .ledger-title {
  color: var(--brass-bright);
}

.section-row .ledger-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.section-row-edit {
  cursor: default;
  padding-right: 18px;
}

.section-row-edit:hover {
  background: transparent;
}

.section-item-row .ledger-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.section-row .search-input {
  flex: 1;
  min-width: 0;
}

.section-select {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
}

.sections-panel {
  max-width: 480px;
}

.picker-list {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.move-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.move-option {
  text-align: left;
}


/* Staff stats page */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 14px;
}

.stats-table th,
.stats-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.stats-table th {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}

.stats-table tbody tr {
  cursor: pointer;
}

.stats-table tbody tr:hover {
  background: var(--panel-alt);
}

.stats-scroll {
  overflow-x: auto;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat-card .stat-value {
  font-size: 22px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 150px 1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.timeline-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.timeline-bar {
  height: 6px;
  border-radius: 3px;
  min-width: 2px;
}

.timeline-bar.loan {
  background: var(--brass-bright);
}

.timeline-bar.ret {
  background: var(--text-muted);
}

.stats-message {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.stats-message .ledger-sub {
  display: block;
  margin-bottom: 2px;
}

.stat-clickable {
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.stat-clickable:hover,
.stat-clickable:focus-visible {
  border-color: var(--brass);
  outline: none;
}

.stat-link {
  color: var(--brass-bright);
  text-decoration: underline;
}

.ledger-row.loans.wide-status {
  grid-template-columns: 1fr 1fr 240px;
}

@media (max-width: 800px) {
  .ledger-row.loans.wide-status {
    grid-template-columns: 1fr;
  }
}