:root {
  color-scheme: dark;
  --bg: #101116;
  --panel: #17181e;
  --panel-2: #20232b;
  --text: #eef2f7;
  --muted: #a6afbc;
  --line: #2c3440;
  --accent: #7c3ff2;
  --accent-2: #6cb4ff;
  --danger: #ef6b73;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  padding: 22px;
  background: #12161d;
}

.brand {
  font-weight: 800;
  font-size: 20px;
  margin-bottom: 6px;
}

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

.nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav a,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  cursor: pointer;
}

.nav a {
  justify-content: flex-start;
}

.nav a.active,
.workspace-nav a.active {
  border-color: var(--accent);
  color: #ffffff;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button.ghost {
  background: transparent;
}

.content {
  padding: 28px;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.card,
.login-card,
.form-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.card h2,
.form-panel h2 {
  font-size: 18px;
  margin: 0 0 8px;
}

.app-row h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 16px;
}

.app-row > p {
  grid-column: 1 / -1;
  margin: 0;
}

.admin-setup-card {
  margin-bottom: 18px;
  border-color: color-mix(in srgb, var(--accent), transparent 45%);
}

.link-card {
  border-color: color-mix(in srgb, var(--accent-2), transparent 48%);
}

.card p {
  min-height: 44px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.serverops-login {
  background: #0f1015;
}

.login-shell {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: minmax(320px, 450px) minmax(320px, 450px);
  gap: 0;
  align-items: stretch;
}

.login-card {
  width: min(440px, 100%);
}

.serverops-card {
  min-height: 548px;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px 0 0 8px;
  background: #101116;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
  justify-content: center;
  padding: 42px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.login-logo {
  display: block;
}

.login-logo img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: #000;
}

.eyebrow,
.small {
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #d4af37;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #7e8794;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.button.discord {
  background: #5865f2;
  border-color: #5865f2;
  color: #fff;
}

.login-brief {
  min-height: 548px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.14), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), transparent 45%),
    #28292a;
  text-align: center;
}

.login-brief img {
  width: min(390px, 100%);
  filter: drop-shadow(0 28px 34px rgba(0, 0, 0, 0.55));
}

.login-disclosure {
  grid-column: 1 / -1;
  max-width: 780px;
  justify-self: center;
  padding: 20px 18px 0;
  margin: 0;
  color: #e5e7eb;
  font-weight: 800;
  line-height: 1.55;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  text-align: center;
}

.rule {
  width: 100%;
  height: 1px;
  background: rgba(245, 245, 245, 0.82);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1319;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.stack {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.role-admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.1fr) minmax(180px, 0.8fr);
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.access-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.access-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.access-card h3 {
  margin: 0;
}

.inline-field {
  min-width: 130px;
}

.field-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.role-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1319;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.check-row span,
.check-row code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-row code {
  grid-column: 2;
  color: var(--muted);
  font-size: 10px;
}

details summary {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 800;
}

.app-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.permission-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(260px, 1.3fr);
  gap: 10px;
  align-items: end;
}

code {
  color: var(--accent-2);
}

.notice {
  border: 1px solid color-mix(in srgb, var(--accent-2), transparent 50%);
  background: color-mix(in srgb, var(--accent-2), transparent 88%);
  border-radius: 8px;
  padding: 12px 14px;
}

.notice.good {
  border-color: color-mix(in srgb, #2f9d74, transparent 40%);
  background: color-mix(in srgb, #2f9d74, transparent 86%);
}

.error {
  border-color: color-mix(in srgb, var(--danger), transparent 35%);
  background: color-mix(in srgb, var(--danger), transparent 88%);
}

.proxy-frame {
  width: 100%;
  height: calc(100vh - 116px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.workspace {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.workspace-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #12161d;
}

.brand-link {
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.workspace-nav,
.workspace-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.workspace-nav {
  overflow-x: auto;
  min-width: 0;
}

.workspace-nav a {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  background: var(--panel);
  font-size: 13px;
  font-weight: 700;
}

.workspace-actions .button {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 13px;
}

.app-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-row {
    grid-template-columns: 1fr;
  }

  .permission-row {
    grid-template-columns: 1fr;
  }

  .workspace-bar {
    grid-template-columns: 1fr;
  }

  .workspace-actions {
    flex-wrap: wrap;
  }

  .serverops-login {
    grid-template-columns: 1fr;
  }

  .login-brief {
    display: none;
  }
}
