:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0b1728;
  --panel: #101d31;
  --panel-2: #14243a;
  --line: #263a55;
  --text: #e8f2ff;
  --muted: #91a6bf;
  --blue: #3c82ff;
  --cyan: #21d4fd;
  --violet: #8f7bff;
  --green: #48d597;
  --red: #ff5d6c;
  --yellow: #f7c948;
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
  --soft-shadow: 0 10px 26px rgba(0, 0, 0, .22);
  --ease: cubic-bezier(.2, .75, .25, 1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, #081526 0%, var(--bg) 34%, #050b14 100%);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

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

@keyframes soft-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(33, 212, 253, .18); }
  50% { box-shadow: 0 0 0 5px rgba(33, 212, 253, 0); }
}

@keyframes progress-glow {
  0% { filter: saturate(1); }
  50% { filter: saturate(1.35) brightness(1.06); }
  100% { filter: saturate(1); }
}

.shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}
.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #07101c 0%, #09182a 100%);
  padding: 18px 12px;
}
.brand {
  margin: 0 6px 16px;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
}
.brand span {
  color: var(--cyan);
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sidebar nav {
  display: grid;
  gap: 6px;
}
.sidebar a {
  align-items: center;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  gap: 9px;
  min-height: 38px;
  padding: 9px 10px;
  position: relative;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.sidebar a:hover, .sidebar a.active {
  background: var(--panel-2);
  color: var(--text);
  transform: translateX(2px);
}
.sidebar a.active::before {
  background: var(--cyan);
  border-radius: 999px;
  content: "";
  height: 18px;
  left: -6px;
  position: absolute;
  width: 3px;
}
.main { min-width: 0; }
.topbar, .auth-brand {
  min-height: 62px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 19, 34, .92);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
}
.topbar span, .auth-brand span { color: var(--muted); font-size: 12px; display: block; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.content {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
  animation: fade-up .22s var(--ease);
}

.panel, .metric, .task-card, .server-card, .member {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease), background .18s var(--ease);
}
.panel { padding: 16px; margin-bottom: 14px; }
.panel:hover, .metric:hover, .task-card:hover, .server-card:hover, .member:hover {
  border-color: rgba(33, 212, 253, .35);
  box-shadow: var(--shadow);
}
.metric:hover, .task-card:hover, .server-card:hover, .member:hover {
  transform: translateY(-2px);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
.prose { max-width: 760px; }
.narrow { width: min(460px, 100%); }

.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.metric {
  display: grid;
  gap: 8px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.metric::after {
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  bottom: 0;
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  width: 100%;
}
.metric span { color: var(--muted); }
.metric strong { font-size: 26px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.toolbar form, .row-actions, .actions, .console-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid h1, .form-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #091524;
  color: var(--text);
  padding: 8px 10px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(33, 212, 253, .12);
  outline: none;
}
.btn, button {
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.btn:hover, button:hover {
  box-shadow: 0 8px 20px rgba(60, 130, 255, .2);
  transform: translateY(-1px);
}
.btn:active, button:active { transform: translateY(0); }
.btn.small { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.btn.ghost, .icon-btn { background: rgba(255, 255, 255, .03); border-color: var(--line); color: var(--text); }
.btn.danger, button.danger { background: var(--red); }
.icon-btn {
  border-radius: 7px;
  min-height: 34px;
  padding: 7px 10px;
}
.icon, .btn-icon .icon {
  fill: none;
  flex: 0 0 auto;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 17px;
}
.brand + nav .icon { opacity: .9; }
.icon-btn b {
  background: var(--cyan);
  color: #06111e;
  border-radius: 999px;
  padding: 1px 6px;
}
.collapsed { display: none; }
.muted, .empty { color: var(--muted); }

.alert {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 11px 12px;
  background: var(--panel-2);
  animation: fade-up .2s var(--ease);
}
.alert.success { border-color: rgba(72, 213, 151, .45); color: #c9ffe6; }
.alert.danger { border-color: rgba(255, 93, 108, .55); color: #ffd6dc; }
.alert.info { border-color: rgba(33, 212, 253, .45); color: #d8f8ff; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { border-bottom: 1px solid var(--line); padding: 9px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
tbody tr {
  transition: background .16s var(--ease);
}
tbody tr:hover { background: rgba(33, 212, 253, .045); }
.badge {
  background: rgba(33, 212, 253, .12);
  border: 1px solid rgba(33, 212, 253, .35);
  border-radius: 999px;
  color: #d8f8ff;
  display: inline-block;
  font-size: 12px;
  padding: 3px 8px;
}
.badge.ok { border-color: rgba(72, 213, 151, .45); color: #c9ffe6; }
.badge.off { border-color: rgba(145, 166, 191, .35); color: var(--muted); }

.list { display: grid; gap: 8px; }
.list a, .notifications article, .server-mini a {
  background: #0b1728;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  transition: border-color .16s var(--ease), transform .16s var(--ease), background .16s var(--ease);
}
.list a:hover, .notifications article:hover, .server-mini a:hover {
  background: #0f2035;
  border-color: rgba(33, 212, 253, .35);
  transform: translateY(-1px);
}
.list span, .server-mini b { color: var(--muted); font-weight: 500; }
.notifications article { display: block; }
.notifications article.unread { border-color: var(--cyan); }

.task-grid, .server-grid, .team-grid, .wiki-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.task-card, .server-card, .member { padding: 14px; }
.task-card header, .server-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.priority-urgent { border-color: rgba(255, 93, 108, .7); }
.priority-important { border-color: rgba(247, 201, 72, .7); }
.progress {
  height: 7px;
  border-radius: 999px;
  background: #07101c;
  overflow: hidden;
  margin: 12px 0;
}
.progress span {
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  display: block;
  height: 100%;
  animation: progress-glow 2.4s ease-in-out infinite;
}
dl { margin: 0; }
.task-card dl, .server-card dl, .info-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 10px;
}
dt { color: var(--muted); }
dd { margin: 0; }
.note {
  border-left: 3px solid var(--cyan);
  color: #cfe8ff;
  padding-left: 10px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.tabs a {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  padding: 8px 10px;
  transition: border-color .16s var(--ease), background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.tabs a.active {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--cyan);
}
.tabs a:hover { transform: translateY(-1px); }
.server-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.console-output {
  background: #03070d;
  border: 1px solid #1d3048;
  border-radius: 8px;
  color: #d7ecff;
  font: 13px/1.5 "Cascadia Mono", Consolas, monospace;
  height: 420px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.console-output .line { display: block; }
.console-output .error { color: #ff8b95; }
.console-output .warn { color: #ffe08a; }
.console-output .info { color: #8cecff; }
.editor textarea {
  min-height: 560px;
  font: 13px/1.5 "Cascadia Mono", Consolas, monospace;
  tab-size: 2;
}
.crumb { color: var(--muted); }

.member img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-2);
}
.member { display: grid; gap: 7px; }
.presence { color: var(--muted); }
.presence.online { color: var(--green); }
.presence.online::before {
  animation: soft-pulse 1.8s ease-in-out infinite;
  background: var(--green);
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 7px;
  margin-right: 6px;
  width: 7px;
}
.presence.abwesend { color: var(--yellow); }

.voice-room .participant-list {
  display: grid;
  gap: 8px;
}
.participant-list div {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  justify-content: space-between;
  padding: 9px;
}
.checks {
  display: grid;
  gap: 4px;
  max-width: 260px;
}
.check {
  display: flex;
  align-items: center;
  gap: 7px;
}
.check input { width: auto; min-height: auto; }
.admin-user-form { display: contents; }
.row-stack {
  display: grid;
  gap: 7px;
  min-width: 280px;
}
.copy-input {
  font: 12px/1.4 "Cascadia Mono", Consolas, monospace;
  min-width: 280px;
  cursor: copy;
}
.copy-input.copied {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(72, 213, 151, .16);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar { align-items: flex-start; flex-direction: column; }
  .grid.two, .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .content { padding: 12px; }
  .server-title { display: block; }
}
