:root {
  --bg: #05020b;
  --bg-soft: #0b0617;
  --panel: rgba(18, 10, 36, 0.78);
  --panel-2: rgba(29, 14, 58, 0.9);
  --text: #f8f4ff;
  --muted: #b9accf;
  --line: rgba(207, 173, 255, 0.18);
  --purple: #8f39ff;
  --magenta: #ff4fd8;
  --cyan: #46d7ff;
  --green: #68ffbd;
  --red: #ff5f8f;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 5%, rgba(143, 57, 255, 0.24), transparent 28rem),
    radial-gradient(circle at 90% 30%, rgba(70, 215, 255, 0.12), transparent 26rem),
    linear-gradient(180deg, var(--bg), #080411 52%, #040207);
  min-height: 100vh;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code { color: var(--cyan); }

.public-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.public-hero {
  position: relative;
  width: min(1180px, 100%);
  min-height: min(760px, calc(100vh - 64px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 32px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(28px, 5vw, 64px);
  background: linear-gradient(135deg, rgba(255,255,255,.075), rgba(143,57,255,.07));
  box-shadow: 0 28px 90px rgba(0, 0, 0, .38);
}

.scanline {
  position: absolute;
  inset: 0;
  opacity: .18;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0, rgba(255,255,255,.08) 50%, transparent 100%);
  background-size: 100% 9px;
}

.public-copy { position: relative; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--cyan);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.eyebrow::before {
  width: 32px;
  height: 1px;
  content: "";
  background: currentColor;
}

h1, h2, h3, p { margin-top: 0; }
.public-copy h1 {
  max-width: 11ch;
  margin: 18px 0;
  font-size: clamp(3.4rem, 8vw, 7rem);
  line-height: .88;
  text-transform: uppercase;
}
.public-copy p, .muted { color: var(--muted); }
.public-copy p { max-width: 62ch; font-size: 1.08rem; }

.public-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
}
.public-grid div, .panel, .metric, .login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
}
.public-grid div { padding: 18px; }
.public-grid strong, .public-grid span { display: block; }
.public-grid span { margin-top: 4px; color: var(--muted); font-size: .92rem; }

.login-card {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 28px;
  background: rgba(7, 3, 16, .72);
  backdrop-filter: blur(18px);
}
.login-card h2 { margin-bottom: 4px; font-size: 2rem; }

label { display: grid; gap: 8px; color: #e9e1f7; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(5, 2, 11, .74);
  outline: none;
}
textarea {
  width: 100%;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  color: var(--text);
  background: rgba(5, 2, 11, .74);
  resize: vertical;
  outline: none;
}
textarea:focus { border-color: rgba(70, 215, 255, .68); box-shadow: 0 0 0 3px rgba(70, 215, 255, .12); }
input:focus, select:focus { border-color: rgba(70, 215, 255, .68); box-shadow: 0 0 0 3px rgba(70, 215, 255, .12); }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--text);
  background: rgba(255,255,255,.065);
  font-weight: 900;
  cursor: pointer;
}
.button.primary { border-color: transparent; background: linear-gradient(135deg, var(--purple), var(--magenta)); }
.button.danger { border-color: rgba(255,95,143,.38); background: rgba(255,95,143,.16); }

.app-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(7, 3, 16, .76);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  font-weight: 900;
}
.brand small { display: block; color: var(--muted); }
.side-nav { display: grid; gap: 7px; }
.side-nav a {
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}
.side-nav a:hover, .side-nav a.active {
  color: var(--text);
  border-color: rgba(195, 92, 255, .34);
  background: rgba(143, 57, 255, .16);
}

.main-panel { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 2, 11, .72);
  backdrop-filter: blur(18px);
}
.topbar h1 { margin: 4px 0 0; font-size: clamp(1.6rem, 3vw, 2.4rem); }
.icon-button {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}
.icon-button span { display: block; width: 18px; height: 2px; margin: 5px auto; background: var(--text); }
.user-menu { display: flex; align-items: center; gap: 12px; }
.user-menu small { display: block; color: var(--muted); }
.avatar-link, .profile-preview > span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--magenta));
  font-weight: 900;
}
.avatar-link img, .profile-preview img { width: 100%; height: 100%; object-fit: cover; }
.text-link { color: var(--cyan); font-weight: 800; }
.content-area { padding: 28px; }

.notice { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 8px; padding: 13px 15px; background: rgba(255,255,255,.06); }
.notice.success { border-color: rgba(104,255,189,.34); color: var(--green); }
.notice.error { border-color: rgba(255,95,143,.42); color: var(--red); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { padding: 20px; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 10px 0 4px; font-size: clamp(2rem, 4vw, 3.2rem); }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { padding: 22px; margin-bottom: 18px; }
.panel.narrow { max-width: 680px; }
.form-stack { display: grid; gap: 16px; }
.inline-form, .action-row, .tabs, .user-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.inline-form input { max-width: 520px; }
.section-head { display: flex; justify-content: space-between; gap: 18px; align-items: start; margin-bottom: 16px; }
.tabs a, .tag-grid span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--muted);
  background: rgba(255,255,255,.055);
  font-weight: 800;
}

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: middle; }
th { color: var(--cyan); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
td { color: #eee7fb; }
td input, td select { min-width: 150px; }
.data-table { border-collapse: separate; border-spacing: 0; }
.data-table tbody tr:nth-child(odd) { background: rgba(255, 255, 255, .026); }
.data-table tbody tr:nth-child(even) { background: rgba(143, 57, 255, .055); }
.data-table tbody tr:hover { background: rgba(70, 215, 255, .075); }
.data-table td, .data-table th { padding: 14px 12px; }
.data-table .button { min-height: 38px; padding-inline: 16px; }
.player-cell strong, .player-cell small { display: block; }
.player-cell strong { color: var(--text); font-weight: 900; }
.player-cell small { margin-top: 4px; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.date-cell { min-width: 150px; white-space: nowrap; }
.reason-cell { min-width: 320px; max-width: 760px; overflow-wrap: anywhere; }
.bans-table { min-width: 1040px; }
.warns-table { min-width: 860px; }
.applications-table { min-width: 1080px; }
.owner-table { min-width: 860px; }
.check { display: inline-flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; white-space: nowrap; }
.check input { width: auto; min-height: auto; }

.profile-preview { display: flex; align-items: center; gap: 14px; }
.profile-preview img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.profile-preview > span { width: 72px; height: 72px; font-size: 1.4rem; }
.profile-preview small { display: block; color: var(--muted); }
.graph-grid { display: grid; gap: 18px; }
.graph-grid article { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: rgba(255,255,255,.04); }
.graph-grid img { width: 100%; height: auto; }
.tag-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.detail-grid, .answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.detail-grid div, .answer-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255,255,255,.045);
}
.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}
.detail-grid strong { display: block; margin-top: 7px; overflow-wrap: anywhere; }
.detail-field-wide { min-width: 0; }
.hex-detail-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hex-detail-actions strong { margin-top: 0; }
.previous-applications-select { margin-top: 10px; min-width: 100%; min-height: 38px; font-size: .84rem; }
.previous-applications-select:disabled { opacity: .58; cursor: not-allowed; }
.answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.answer-grid p { color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid, .public-hero, .detail-grid, .answer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .icon-button { display: block; }
  .topbar { align-items: flex-start; }
  .user-menu { flex-wrap: wrap; justify-content: flex-end; }
  .public-shell, .content-area { padding: 18px; }
  .public-grid, .metric-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .public-copy h1 { font-size: 3.2rem; }
  .section-head { display: grid; }
  .topbar { display: grid; grid-template-columns: auto 1fr; }
  .user-menu { grid-column: 1 / -1; justify-content: flex-start; }
}

.status-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.new {
  color: var(--cyan);
  background: rgba(70, 215, 255, .11);
  border-color: rgba(70, 215, 255, .28);
}

.status-badge.warning {
  color: #ffd166;
  background: rgba(255, 209, 102, .11);
  border-color: rgba(255, 209, 102, .28);
}

.status-badge.success {
  color: var(--green);
  background: rgba(104, 255, 189, .11);
  border-color: rgba(104, 255, 189, .28);
}

.status-badge.danger {
  color: var(--red);
  background: rgba(255, 95, 143, .12);
  border-color: rgba(255, 95, 143, .34);
}

.status-badge.muted {
  color: var(--muted);
  background: rgba(255,255,255,.055);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
}
.pagination a {
  display: inline-flex;
  min-width: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  color: var(--muted);
  background: rgba(255,255,255,.055);
  font-weight: 900;
}
.pagination a:hover,
.pagination a.active {
  color: var(--text);
  border-color: rgba(70, 215, 255, .38);
  background: rgba(70, 215, 255, .12);
}
.readonly-notes {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255,255,255,.045);
  margin-bottom: 14px;
}
.readonly-notes h3 {
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: .9rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.readonly-notes p {
  margin-bottom: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.text-success {
  color: var(--green);
}

.text-danger {
  color: var(--red);
}


.applications-search {
  display: grid;
  grid-template-columns: minmax(280px, 520px) auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 16px;
}

.applications-search label {
  margin: 0;
}

.applications-search [data-applications-loading] {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.empty-table-cell {
  color: var(--muted);
  text-align: center;
}

.tabs a.active {
  color: var(--text);
  border-color: rgba(70, 215, 255, .38);
  background: rgba(70, 215, 255, .12);
}

@media (max-width: 760px) {
  .applications-search {
    grid-template-columns: 1fr;
  }
}

