:root {
  color-scheme: dark;
  --bg: #0b1012;
  --surface: #181e21;
  --surface-raised: #1e2529;
  --surface-soft: #232b2f;
  --line: #30393e;
  --line-strong: #3a454a;
  --grid-line: rgba(126, 145, 151, 0.11);
  --text: #f1f5f3;
  --muted: #9ca6aa;
  --faint: #697479;
  --accent: #1fc99b;
  --accent-bright: #5ce8be;
  --accent-deep: #0b7e63;
  --accent-ink: #08271e;
  --red: #d23b58;
  --red-soft: rgba(210, 59, 88, 0.12);
  --yellow: #e8be5d;
  --shadow: rgba(0, 0, 0, 0.28);
  --font-ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 300px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 300px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 32% 20%, rgba(20, 149, 113, 0.12), transparent 28rem),
    radial-gradient(circle at 88% 0%, rgba(39, 70, 121, 0.16), transparent 34rem),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, 68px 68px, 68px 68px;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  top: -70px;
  left: 14px;
  z-index: 30;
  padding: 10px 14px;
  color: var(--accent-ink);
  background: var(--accent-bright);
  border-radius: 7px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.session-inner,
.page-shell,
.brain-footer {
  width: min(1380px, calc(100% - 48px));
  margin-inline: auto;
}

.session-bar {
  position: relative;
  z-index: 10;
  background: rgba(11, 16, 18, 0.82);
  border-bottom: 1px solid rgba(136, 151, 157, 0.18);
  backdrop-filter: blur(18px);
}

.session-inner {
  min-height: 72px;
  padding-block: 9px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.session-brand,
.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.session-brand {
  margin-right: auto;
  font-size: 1rem;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-deep));
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9px 16px 9px 16px;
  box-shadow: 0 0 22px rgba(31, 201, 155, 0.16);
  display: grid;
  place-items: center;
  transform: rotate(-8deg);
}

.brand-mark span {
  width: 42%;
  height: 42%;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-top-color: transparent;
  border-radius: 50%;
}

.session-copy,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.session-copy {
  color: var(--muted);
  font-size: 0.76rem;
}

.session-copy strong {
  color: var(--text);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(31, 201, 155, 0.09), 0 0 10px rgba(31, 201, 155, 0.5);
}

.role-tag {
  padding: 3px 6px;
  color: var(--accent-bright);
  background: rgba(31, 201, 155, 0.08);
  border: 1px solid rgba(31, 201, 155, 0.2);
  border-radius: 5px;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.nav-actions {
  gap: 5px;
}

.nav-actions a {
  padding: 8px 11px;
  color: var(--muted);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.nav-actions a:hover,
.nav-actions a:focus-visible {
  color: var(--text);
  background: var(--surface-raised);
  outline: none;
}

.nav-actions form,
.admin-actions form {
  margin: 0;
}

.page-shell {
  flex: 1;
  padding-block: clamp(38px, 5vw, 66px) 80px;
}

.page-heading {
  margin-bottom: 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-heading h1,
.panel-body h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 630;
  line-height: 1;
  letter-spacing: -0.045em;
}

.panel-body h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.eyebrow,
.terminal-prompt {
  margin: 0 0 10px;
  color: var(--accent-bright);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.terminal-prompt {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.panel {
  overflow: hidden;
  background: rgba(24, 30, 33, 0.96);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 60px var(--shadow);
}

.panel-titlebar {
  min-height: 43px;
  padding: 10px 14px;
  color: #cbd3d1;
  background: rgba(31, 39, 43, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 0.67rem;
  font-weight: 650;
  letter-spacing: 0.09em;
}

.panel-titlebar > span:last-child {
  color: var(--faint);
}

.panel-body {
  padding: clamp(22px, 4vw, 38px);
}

.button {
  min-height: 38px;
  padding: 9px 13px;
  color: #d5dcda;
  background: #293136;
  border: 1px solid #394349;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.15;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover,
.button:focus-visible {
  color: var(--text);
  background: #333c41;
  border-color: #536067;
  outline: 2px solid rgba(92, 232, 190, 0.14);
  outline-offset: 2px;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #16a982);
  border-color: #32d2a5;
  box-shadow: 0 8px 22px rgba(14, 125, 94, 0.15);
}

.button-primary:hover,
.button-primary:focus-visible {
  color: #061b15;
  background: var(--accent-bright);
  border-color: #8ef5d6;
}

.button-danger {
  color: #fff;
  background: #b82f49;
  border-color: #d44c65;
}

.button-danger:hover,
.button-danger:focus-visible {
  background: var(--red);
  border-color: #ef7087;
  outline-color: rgba(210, 59, 88, 0.22);
}

.button-small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.7rem;
}

.button-wide {
  width: 100%;
  margin-top: 14px;
}

.is-disabled {
  opacity: 0.38;
  pointer-events: none;
}

.filter-panel {
  margin-bottom: 24px;
}

.filter-form {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) minmax(160px, 1fr) 110px auto;
  align-items: end;
  gap: 15px;
}

.field,
.stack-form {
  display: flex;
  flex-direction: column;
}

.field label,
.stack-form > label:not(.check-row) {
  margin-bottom: 7px;
  color: #b8c1bf;
  font-size: 0.67rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: #151b1e;
  border: 1px solid #364045;
  border-radius: 7px;
  outline: none;
}

input,
select {
  min-height: 42px;
}

input::placeholder,
textarea::placeholder {
  color: #616c71;
}

select {
  color-scheme: dark;
}

textarea {
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #46535a;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 201, 155, 0.13);
}

.filter-actions,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.data-panel {
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  background: rgba(20, 26, 29, 0.72);
}

th,
td {
  padding: 13px 12px;
  border-right: 1px solid #293236;
  border-bottom: 1px solid #293236;
  text-align: left;
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  color: #9da8ab;
  background: #1e2529;
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

th a {
  color: inherit;
  text-decoration: none;
}

th a:hover {
  color: var(--accent-bright);
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:nth-child(even) {
  background: rgba(37, 45, 49, 0.42);
}

tbody tr:hover {
  background: rgba(31, 201, 155, 0.045);
}

td {
  color: #c1c9c7;
  font-size: 0.76rem;
}

.cell-strong {
  color: var(--text);
  font-weight: 650;
}

code {
  max-width: 100%;
  color: #b7decf;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.copy-button,
.link-button {
  padding: 4px 7px;
  color: var(--accent-bright);
  background: rgba(31, 201, 155, 0.07);
  border: 1px solid rgba(31, 201, 155, 0.19);
  border-radius: 5px;
  font-size: 0.64rem;
  font-weight: 650;
}

.copy-button {
  margin: 4px 0 0 5px;
}

.copy-button:hover,
.link-button:hover {
  background: rgba(31, 201, 155, 0.14);
}

.link-button {
  background: transparent;
}

.comment-cell {
  min-width: 180px;
  max-width: 300px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.date-cell {
  min-width: 132px;
  color: #7f8b90;
  font-size: 0.7rem;
  white-space: nowrap;
}

.action-cell {
  min-width: 125px;
}

.action-cell a {
  color: #b9d8ce;
  text-underline-offset: 3px;
}

.action-cell > * {
  margin-right: 7px;
}

.admin-actions {
  min-width: 270px;
}

.admin-actions,
.admin-actions form {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
}

.danger-link,
.action-cell .danger-link {
  color: #ef7d92;
  font-weight: 650;
}

.empty-state {
  padding: 52px 20px;
  color: var(--muted);
  text-align: center;
}

.pagination {
  margin-top: 22px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: var(--muted);
  font-size: 0.72rem;
}

.pagination > div {
  display: flex;
  gap: 10px;
}

.login-shell {
  position: relative;
  display: grid;
  place-items: center;
}

.login-shell::before {
  content: "";
  position: absolute;
  width: min(640px, 90vw);
  height: min(640px, 90vw);
  background: radial-gradient(circle, rgba(31, 201, 155, 0.09), transparent 68%);
  pointer-events: none;
}

.login-panel,
.form-panel,
.confirm-panel,
.error-panel {
  position: relative;
  width: min(100%, 700px);
  margin-inline: auto;
}

.login-panel {
  width: min(100%, 510px);
}

.login-brand {
  margin-bottom: 34px;
  color: #dce3e1;
  font-size: 0.94rem;
}

.login-brand .brand-mark {
  width: 38px;
  height: 38px;
}

.login-panel h1,
.confirm-panel h1,
.error-panel h1 {
  margin-bottom: 13px;
}

.muted {
  color: var(--muted);
}

.login-panel .muted {
  margin-bottom: 26px;
}

.stack-form {
  gap: 9px;
}

.stack-form > label:not(:first-of-type, .check-row) {
  margin-top: 10px;
}

.form-actions {
  margin-top: 25px;
}

.check-row {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c7cfcd;
  font-size: 0.78rem;
  font-weight: 600;
}

.check-row input {
  width: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.alert {
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 600;
}

.alert-error {
  color: #ffc6d0;
  background: var(--red-soft);
  border-color: rgba(210, 59, 88, 0.35);
}

.danger-title {
  color: #ffb1bf;
  background: rgba(101, 25, 40, 0.72);
  border-bottom-color: rgba(210, 59, 88, 0.35);
}

.danger-title > span:last-child {
  color: #ff8fa3;
}

.confirm-details {
  margin-block: 25px;
  padding: 17px;
  background: #151b1e;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 9px 14px;
}

.confirm-details dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.confirm-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.error-code {
  margin: 0 0 20px;
  color: var(--accent-bright);
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 650;
  line-height: 0.85;
  letter-spacing: -0.06em;
}

.status-label {
  padding: 4px 7px;
  border: 1px solid;
  border-radius: 5px;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-label.is-active {
  color: var(--accent-bright);
  background: rgba(31, 201, 155, 0.08);
  border-color: rgba(31, 201, 155, 0.22);
}

.status-label.is-inactive {
  color: #f28da0;
  background: var(--red-soft);
  border-color: rgba(210, 59, 88, 0.28);
}

.mobile-only {
  display: none;
}

.copy-helper {
  position: fixed;
  top: 0;
  left: -9999px;
}

.brain-footer {
  padding-block: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--faint);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brain-footer span:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brain-footer i {
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(31, 201, 155, 0.55);
}

@media (max-width: 1050px) {
  .session-label {
    display: none;
  }

  .filter-form {
    grid-template-columns: 2fr 1fr 1fr;
  }

  .filter-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .session-inner,
  .page-shell,
  .brain-footer {
    width: min(100% - 26px, 1380px);
  }

  .session-inner {
    min-height: 64px;
    flex-wrap: wrap;
    gap: 10px 16px;
  }

  .session-brand {
    margin-right: 0;
  }

  .session-copy {
    margin-left: auto;
  }

  .nav-actions {
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    justify-content: flex-start;
  }

  .nav-actions form {
    margin-left: auto;
  }

  .page-shell {
    padding-block: 34px 58px;
  }

  .page-heading,
  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading .button {
    align-self: flex-start;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }

  .field-small {
    max-width: none;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }

  .data-panel {
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .wallet-cards {
    display: grid;
    gap: 15px;
  }

  .wallet-card {
    min-width: 0;
    overflow: hidden;
    background: rgba(24, 30, 33, 0.96);
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.2);
  }

  .wallet-card-head {
    padding: 12px 14px;
    color: var(--text);
    background: var(--surface-raised);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.78rem;
  }

  .wallet-card-head span {
    color: var(--accent-bright);
  }

  .wallet-card-body {
    padding: 16px;
    color: #c1c9c7;
  }

  .wallet-card-body code {
    display: inline-block;
  }

  .wallet-card-body dl {
    margin-bottom: 0;
    display: grid;
    grid-template-columns: 75px 1fr;
    gap: 6px 10px;
    color: var(--muted);
    font-size: 0.7rem;
  }

  .wallet-card-body dd {
    margin: 0;
  }

  .mobile-label {
    margin: 14px 0 5px;
    color: var(--faint);
    font-size: 0.63rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .comment-text {
    margin-top: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }

  .wallet-card-actions {
    padding: 12px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .wallet-card-actions form,
  .wallet-card-actions form .button {
    width: 100%;
  }

  .admin-mobile-actions {
    grid-template-columns: 1fr 1fr;
  }

  .pagination > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .brain-footer {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .session-copy .role-tag {
    display: none;
  }

  .nav-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .nav-actions form {
    margin-left: auto;
  }

  .pagination > div,
  .form-actions,
  .wallet-card-actions,
  .admin-mobile-actions {
    grid-template-columns: 1fr;
  }

  .confirm-details {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
