:root {
  color-scheme: dark;
  --bg: #07090f;
  --bg-2: #0b0f18;
  --panel: #111827;
  --panel-2: #151f2f;
  --line: #243044;
  --text: #eef2ff;
  --muted: #98a2b3;
  --soft: #cbd5e1;
  --red: #00e5ff;
  --red-2: #8b5cf6;
  --green: #22c55e;
  --amber: #f59e0b;
  --blue: #60a5fa;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .35);
  --accent: var(--red);
  --accent-rgb: 0, 229, 255;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.light {
  --bg: #edf2ff;
  --bg-2: #f8fafc;
  --panel: rgba(255, 255, 255, .72);
  --panel-2: rgba(255, 255, 255, .86);
  --line: rgba(80, 91, 120, .22);
  --text: #111827;
  --muted: #64748b;
  --soft: #334155;
  --shadow: 0 24px 60px rgba(15, 23, 42, .14);
}

body.amoled {
  --bg: #000;
  --bg-2: #020202;
  --panel: rgba(4, 4, 5, .88);
  --panel-2: rgba(8, 8, 10, .92);
  --line: rgba(255, 255, 255, .12);
  --shadow: 0 18px 48px rgba(0, 0, 0, .72);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(0, 229, 255, .16), transparent 34rem),
    linear-gradient(145deg, var(--bg), var(--bg-2) 44%, #090b12);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    conic-gradient(from 180deg at 30% 20%, rgba(var(--accent-rgb), .26), transparent 28%, rgba(96, 165, 250, .18), transparent 55%, rgba(34, 197, 94, .12), rgba(var(--accent-rgb), .18)),
    radial-gradient(circle at 70% 15%, rgba(96, 165, 250, .26), transparent 28rem);
  filter: blur(44px);
  animation: aurora 18s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  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: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

@keyframes aurora {
  from { transform: translate3d(-2%, -1%, 0) rotate(0deg) scale(1); }
  to { transform: translate3d(2%, 1%, 0) rotate(8deg) scale(1.08); }
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #7f1d1d);
  color: #020617;
  box-shadow: 0 12px 28px rgba(var(--accent-rgb), .24);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span, .sidebar-status, .topbar p, label, small {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--soft);
  background: transparent;
  text-align: left;
  transition: background .18s, color .18s, transform .18s;
}

.nav button:hover, .nav button.active {
  background: rgba(var(--accent-rgb), .12);
  color: white;
}

.nav button.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-status {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 39, .7);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(245, 158, 11, .12);
}

.dot.online {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, .12);
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.04;
  letter-spacing: 0;
}

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

h3 {
  font-size: 14px;
  color: var(--soft);
  margin-top: 18px;
}

.user-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(var(--accent-rgb), .35);
  border-radius: 999px;
  color: #fecaca;
  background: rgba(var(--accent-rgb), .1);
  font-size: 13px;
  white-space: nowrap;
}

.primary, .ghost {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 700;
  letter-spacing: 0;
}

.primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, black));
  box-shadow: 0 12px 28px rgba(var(--accent-rgb), .2);
}

.ghost {
  color: var(--soft);
  background: #151f2f;
  border: 1px solid var(--line);
}

.notice, .panel, .metrics article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 92%, transparent), color-mix(in srgb, var(--panel) 86%, transparent));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.25);
}

.notice {
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.notice div {
  display: grid;
  gap: 7px;
}

.notice code {
  display: block;
  max-width: min(760px, 82vw);
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #090d16;
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, .28);
  overflow-wrap: anywhere;
}

.notice-actions {
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: row;
  gap: 10px;
  align-items: center;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.hero-strip {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  margin-bottom: 16px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(var(--accent-rgb), .34);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), .2), transparent 46%),
    radial-gradient(circle at 85% 15%, rgba(139, 92, 246, .28), transparent 20rem),
    color-mix(in srgb, var(--panel-2) 86%, transparent);
  box-shadow: 0 28px 80px rgba(var(--accent-rgb), .14);
  backdrop-filter: blur(20px) saturate(1.35);
}

.hero-strip::after {
  content: "";
  position: absolute;
  inset: auto -10% -45% 35%;
  height: 160px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent);
  transform: rotate(-8deg);
  animation: sweep 7s ease-in-out infinite;
}

.hero-strip span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
}

.hero-strip strong {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 760px;
  margin-top: 10px;
  font-size: clamp(24px, 3.4vw, 42px);
  line-height: 1.05;
}

.hero-badges {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hero-badges span {
  min-height: 34px;
  padding: 9px 11px;
  border: 1px solid rgba(var(--accent-rgb), .36);
  border-radius: 999px;
  color: var(--text);
  background: rgba(7, 9, 15, .42);
  letter-spacing: 0;
}

@keyframes sweep {
  0%, 42% { transform: translateX(-24%) rotate(-8deg); opacity: 0; }
  52% { opacity: .65; }
  100% { transform: translateX(64%) rotate(-8deg); opacity: 0; }
}

.network-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.network-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), .16), transparent 42%),
    color-mix(in srgb, var(--panel-2) 88%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.network-card:hover {
  transform: translateY(-3px) rotateX(1deg);
  border-color: rgba(var(--accent-rgb), .55);
  box-shadow: 0 24px 70px rgba(var(--accent-rgb), .18);
}

.network-card strong {
  display: block;
  font-size: 19px;
  margin-bottom: 8px;
}

.network-card span {
  color: var(--muted);
  display: block;
  margin-bottom: 14px;
}

.network-card button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: white;
  background: rgba(var(--accent-rgb), .72);
}

.accent-picker {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #151f2f;
  color: var(--soft);
}

.accent-picker input {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
}

.metrics article {
  padding: 16px;
}

.metrics span, .status-grid span, .mini-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

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

.grid {
  display: grid;
  gap: 16px;
}

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

.panel {
  padding: 18px;
}

.panel.wide {
  max-width: 1100px;
}

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

.status-grid div {
  min-height: 76px;
  padding: 12px;
  border: 1px solid rgba(36, 48, 68, .72);
  border-radius: var(--radius);
  background: rgba(7, 9, 15, .35);
}

.status-grid strong {
  display: block;
  margin-top: 6px;
  color: white;
  overflow-wrap: anywhere;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item, .ticket-card {
  border: 1px solid rgba(36, 48, 68, .8);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(7, 9, 15, .38);
}

.timeline-item strong, .ticket-card strong {
  display: block;
  margin-bottom: 4px;
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
}

input, textarea, select {
  width: 100%;
  color: var(--text);
  background: #090d16;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  padding: 11px 12px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(239, 68, 68, .75);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}

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

.actions, .toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar input {
  flex: 1;
  min-width: 260px;
}

.discord-embed {
  min-height: 210px;
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 18px;
  background: #0b0f18;
  box-shadow: inset 0 0 0 1px rgba(36, 48, 68, .75);
}

.discord-embed strong {
  display: block;
  font-size: 20px;
  margin-bottom: 10px;
}

.discord-embed p {
  color: var(--soft);
  white-space: pre-wrap;
  margin-bottom: 16px;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.mini-stats span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(7, 9, 15, .42);
}

.ticket-list {
  display: grid;
  gap: 12px;
}

.ticket-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ticket-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(96, 165, 250, .12);
  color: #bfdbfe;
  font-size: 12px;
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ticket-actions button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--soft);
  background: #151f2f;
  border: 1px solid var(--line);
}

.category-editor {
  display: grid;
  gap: 10px;
}

.category-row {
  display: grid;
  grid-template-columns: .7fr 1.2fr 1fr .8fr;
  gap: 10px;
  align-items: end;
}

.table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, minmax(90px, .5fr));
  gap: 10px;
  align-items: center;
  padding: 11px;
  border-radius: var(--radius);
  background: rgba(7, 9, 15, .38);
  border: 1px solid rgba(36, 48, 68, .8);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  padding: 13px 15px;
  border-radius: var(--radius);
  color: white;
  background: #151f2f;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .main, .sidebar { padding: 16px; }
  .topbar { display: grid; }
  .nav { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row, .category-row, .status-grid, .table-row { grid-template-columns: 1fr; }
  .ticket-card { grid-template-columns: 1fr; }
  .ticket-actions { justify-content: flex-start; }
  h1 { font-size: 31px; }
}

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