:root {
  color-scheme: dark;
  --bg: #050a08;
  --panel: #08110e;
  --panel-2: #0d1713;
  --panel-3: #111c17;
  --text: #edf7f2;
  --muted: #98a7a0;
  --line: #23342d;
  --green: #16a34a;
  --green-2: #22c55e;
  --green-3: #00f0a0;
  --red: #ff4d3d;
  --yellow: #f5b849;
  --blue: #69a7ff;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 70% 10%, rgba(22, 163, 74, 0.08), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a {
  color: inherit;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: 58px;
  display: grid;
  grid-template-columns: 280px minmax(340px, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(35, 52, 45, 0.78);
  background: rgba(5, 10, 8, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  width: 29px;
  height: 29px;
  border-radius: 8px;
  object-fit: cover;
}

.brand strong {
  font-size: 22px;
  line-height: 1;
}

.brand span {
  color: var(--muted);
  font-weight: 800;
}

.search-shell {
  justify-self: center;
  width: min(100%, 440px);
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(8, 17, 14, 0.9);
  color: var(--muted);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-shell:focus-within {
  border-color: var(--green-2);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
}

.search-shell input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-shell kbd {
  color: #87958e;
  font-family: inherit;
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 800;
  font-size: 14px;
}

.top-actions a {
  color: #c6d2cc;
  text-decoration: none;
}

.is-public .search-shell {
  visibility: hidden;
}

.is-public .sidebar,
.is-public .main {
  display: none;
}

.public-gate {
  min-height: 100vh;
  display: none;
  grid-template-columns: minmax(320px, 0.88fr) minmax(360px, 1.12fr);
  gap: 34px;
  align-items: center;
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 118px 0 64px;
}

.is-public .public-gate {
  display: grid;
}

.public-copy h1 {
  max-width: 620px;
  margin-bottom: 15px;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 0.98;
}

.public-copy p {
  max-width: 620px;
  color: #b9c8c1;
  font-size: 18px;
}

.public-actions,
.public-notes,
.mini-tabs,
.mini-stat-row,
.mini-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.public-actions {
  margin: 24px 0 18px;
}

.public-actions .green-button,
.public-actions .outline-button,
.public-actions .ghost-button {
  min-height: 42px;
}

.public-notes span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 17, 14, 0.7);
  color: #c5d2cc;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}

.mini-dashboard {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 17, 14, 0.9);
  padding: 18px;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.28);
}

.mini-tabs {
  margin-bottom: 14px;
}

.mini-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #08110e;
  color: #c9d6d0;
  padding: 0 12px;
  cursor: pointer;
}

.mini-tabs button.active {
  border-color: #137344;
  background: #06301f;
  color: var(--green-3);
  font-weight: 900;
}

.mini-panel {
  display: none;
  animation: view-enter 180ms ease both;
}

.mini-panel.active {
  display: block;
}

.mini-stat-row {
  margin-bottom: 14px;
}

.mini-stat-row div {
  flex: 1 1 140px;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1511;
  padding: 13px;
}

.mini-stat-row span,
.mini-list span,
.mini-ticket p {
  color: var(--muted);
}

.mini-stat-row strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-list div,
.mini-ticket {
  border: 1px solid #1f332b;
  border-radius: 10px;
  background: #0b1511;
  padding: 12px;
}

.mini-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-ticket + .mini-ticket {
  margin-top: 10px;
}

.mini-ticket strong {
  display: block;
  margin: 8px 0 4px;
}

.mini-colors {
  margin-top: 12px;
}

.mini-colors button {
  width: 34px;
  height: 34px;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.mini-colors button[data-preview-color="#16a34a"] { background: #16a34a; }
.mini-colors button[data-preview-color="#69a7ff"] { background: #69a7ff; }
.mini-colors button[data-preview-color="#f5b849"] { background: #f5b849; }
.mini-colors button.active {
  border-color: var(--text);
}

.sidebar {
  position: fixed;
  inset: 58px auto 0 0;
  z-index: 30;
  width: 292px;
  overflow-y: auto;
  padding: 24px 20px 34px;
  border-right: 1px solid rgba(35, 52, 45, 0.78);
  background: #06100d;
}

.server-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #091511;
}

.server-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #07331f;
  color: var(--green-3);
  font-weight: 900;
}

.server-card strong,
.server-card span {
  display: block;
}

.server-card span {
  color: var(--muted);
  font-size: 13px;
}

.server-select-label {
  display: block;
  margin: 18px 0 7px;
  color: #dce8e2;
  font-size: 13px;
  font-weight: 800;
}

.server-select,
.server-dropdown-button,
.settings-form input,
.settings-form textarea,
.modal-label input,
.modal-label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #08110e;
  color: var(--text);
  padding: 10px 11px;
  outline: 0;
}

.server-select:focus,
.server-dropdown-button:focus,
.settings-form input:focus,
.settings-form textarea:focus,
.modal-label input:focus,
.modal-label textarea:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
}

.server-dropdown {
  position: relative;
}

.server-dropdown-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  cursor: pointer;
}

.server-mini-icon,
.server-option-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #07331f;
  color: var(--green-3);
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
}

.server-mini-icon img,
.server-option-icon img,
.server-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.server-dropdown-menu {
  position: absolute;
  z-index: 55;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: grid;
  gap: 4px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #08110e;
  padding: 6px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  animation: card-enter 160ms ease both;
}

.server-dropdown-menu[hidden] {
  display: none;
}

.server-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 7px;
  cursor: pointer;
}

.server-option:hover,
.server-option.active {
  background: #06301f;
}

.server-option small {
  display: block;
  color: var(--muted);
}

.side-nav {
  display: grid;
  gap: 6px;
  margin: 28px 0;
}

.side-nav button,
.quick-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 39px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #aebcb5;
  text-align: left;
  cursor: pointer;
  padding: 0 12px;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.side-nav button:hover,
.quick-actions button:hover {
  background: #0d1c15;
  color: var(--text);
  transform: translateX(2px);
}

.side-nav button.active {
  background: #06301f;
  color: var(--green-3);
  font-weight: 800;
}

.plan-card {
  border: 1px solid #145f37;
  border-radius: 12px;
  padding: 15px;
  background: linear-gradient(180deg, rgba(6, 48, 31, 0.92), rgba(8, 17, 14, 0.92));
}

.plan-card span,
.plan-card p {
  color: #a9bbb2;
}

.plan-card strong {
  display: block;
  margin: 3px 0 7px;
  font-size: 28px;
}

.plan-card p {
  margin: 0;
  font-size: 13px;
}

.empty-state {
  margin-top: 12px;
  border: 1px solid #3b2d14;
  border-radius: 10px;
  background: #21190d;
  color: #ffd98a;
  padding: 12px;
  font-size: 13px;
}

.main {
  margin-left: 292px;
  padding: 92px 44px 72px;
}

.view {
  display: none;
  animation: view-enter 190ms ease both;
}

.view.active {
  display: block;
}

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

.page-heading.compact {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green-3);
  font-weight: 900;
  font-size: 14px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 3px;
  font-size: 18px;
}

.page-heading span,
.panel-header span,
.muted {
  color: var(--muted);
}

.heading-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.green-button,
.outline-button,
.ghost-button,
.icon-button {
  min-height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.green-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--green);
  background: var(--green);
  color: #03120a;
  padding: 0 15px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(22, 163, 74, 0.22);
  text-decoration: none;
}

.green-button:hover {
  background: var(--green-2);
  box-shadow: 0 16px 34px rgba(34, 197, 94, 0.3);
  transform: translateY(-1px);
}

.outline-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(8, 17, 14, 0.76);
  color: #dce8e2;
  padding: 0 13px;
  text-decoration: none;
}

.outline-button:hover,
.ghost-button:hover,
.icon-button:hover {
  border-color: var(--green-2);
  background: #0c2117;
  transform: translateY(-1px);
}

.ghost-button.small {
  min-height: 31px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button {
  width: 36px;
  padding: 0;
  display: grid;
  place-items: center;
}

.menu-button {
  display: none;
}

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

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 17, 14, 0.88);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

.stat-card {
  padding: 16px;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 6px 0;
  font-size: 32px;
  line-height: 1;
}

.dashboard-grid,
.analytics-grid,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 14px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 18px;
}

.panel.wide {
  grid-column: span 1;
}

.settings-grid .wide,
.analytics-grid .wide {
  grid-column: span 1;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.chart-bars {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 12px;
  padding-top: 16px;
}

.chart-bars span {
  position: relative;
  height: var(--h);
  min-height: 30px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--green-2), #0d5a35);
  animation: bar-rise 520ms ease both;
}

.chart-bars b {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 12px;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-list div,
.leaderboard li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #16241e;
  padding: 10px 0;
}

.status-list div:first-child,
.leaderboard li:first-child {
  padding-top: 0;
}

.status-list span,
.leaderboard span {
  color: #c4d0ca;
}

.table-shell {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid #16241e;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #e7f0eb;
  font-size: 13px;
}

td {
  color: #c6d3cd;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill.review { background: #1a2b45; color: #8fc0ff; }
.pill.shortlisted { background: #2b2410; color: #ffd16a; }
.pill.approved { background: #06351f; color: #6dffad; }
.pill.rejected { background: #351513; color: #ff9b91; }
.pill.queue { background: #151f1b; color: #aebbb5; }
.pill.open { background: #1a2b45; color: #8fc0ff; }
.pill.waiting { background: #2b2410; color: #ffd16a; }
.pill.resolved { background: #06351f; color: #6dffad; }

.inline-select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #08110e;
  color: var(--text);
  padding: 0 8px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #08110e;
  color: #c9d6d0;
  padding: 0 12px;
  cursor: pointer;
}

.filter.active {
  background: #06301f;
  border-color: #137344;
  color: var(--green-3);
}

.ticket-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ticket-column {
  min-height: 440px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 17, 14, 0.72);
  padding: 14px;
}

.ticket-card {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid #1f332b;
  border-radius: 10px;
  background: #0b1511;
  animation: card-enter 210ms ease both;
}

.ticket-card strong,
.ticket-card span {
  display: block;
}

.ticket-card span,
.ticket-card small {
  color: var(--muted);
}

.line-chart {
  height: 260px;
}

.line-chart svg {
  width: 100%;
  height: 100%;
}

.chart-grid-line {
  stroke: #1a2a24;
}

.line-path {
  fill: none;
  stroke: var(--green-2);
  stroke-width: 4;
}

.chart-dots {
  fill: #9cffc3;
  stroke: #06301f;
  stroke-width: 2;
}

.leaderboard {
  margin: 0;
  padding-left: 18px;
}

.settings-form,
.modal-card {
  display: grid;
  gap: 13px;
}

.settings-form label,
.modal-label {
  display: grid;
  gap: 7px;
  color: #dce8e2;
  font-weight: 800;
}

.modal-label textarea {
  min-height: 120px;
  resize: vertical;
}

.settings-form textarea {
  min-height: 92px;
  resize: vertical;
}

.preview-card {
  min-height: 320px;
}

.discord-preview {
  border-left: 4px solid var(--green-2);
  border-radius: 8px;
  padding: 18px;
  background: #10141b;
}

.discord-preview strong {
  display: block;
  margin-bottom: 7px;
  font-size: 18px;
}

.discord-preview p {
  color: #c2c8d0;
}

.discord-preview button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: #5865f2;
  color: white;
  padding: 0 12px;
}

.access-flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 15px;
}

.access-flow span {
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #dce8e2;
  background: #0b1511;
  text-align: center;
  font-weight: 800;
}

.quick-actions {
  display: grid;
  gap: 8px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.58);
  animation: fade-in 150ms ease both;
}

.modal-card {
  position: fixed;
  z-index: 90;
  top: 50%;
  left: 50%;
  width: min(460px, calc(100vw - 28px));
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #08110e;
  padding: 20px;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.5);
  animation: modal-pop 190ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-card.wide-modal {
  width: min(760px, calc(100vw - 28px));
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.review-grid .full-row {
  grid-column: 1 / -1;
}

.flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.flag-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #dce8e2;
  font-weight: 800;
}

.flag-row input {
  width: auto;
}

.detail-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b1511;
  padding: 12px;
  color: #c6d3cd;
  white-space: pre-wrap;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.danger-text {
  color: #ffd98a;
  font-size: 13px;
}

.modal-close {
  justify-self: end;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b1511;
  color: var(--text);
}

.full {
  width: 100%;
}

.modal-action {
  min-height: 40px;
}

code {
  border-radius: 5px;
  background: #14201a;
  padding: 2px 5px;
}

.toast {
  position: fixed;
  z-index: 120;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid #145f37;
  border-radius: 12px;
  background: #082015;
  color: #dff9eb;
  padding: 12px 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  animation: modal-pop 190ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.toast.error {
  border-color: #7f1d1d;
  background: #2a1111;
  color: #ffd6d6;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bar-rise {
  from { transform: scaleY(0.2); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(0.98); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .analytics-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .ticket-board {
    grid-template-columns: 1fr;
  }

  .public-gate {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 12px;
  }

  .search-shell,
  .top-actions a,
  .top-actions .ghost-button {
    display: none;
  }

  .menu-button {
    display: grid;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 84px 18px 48px;
  }

  .page-heading {
    display: grid;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .access-flow {
    grid-template-columns: 1fr;
  }

  .public-gate {
    width: min(100vw - 28px, 680px);
    padding-top: 92px;
  }

  .public-copy h1 {
    font-size: 40px;
  }
}
