:root {
  --bg: #07111f;
  --bg2: #0c1c30;
  --panel: rgba(10, 24, 44, 0.88);
  --panel-2: rgba(13, 31, 55, 0.96);
  --line: rgba(255,255,255,0.08);
  --text: #e9efff;
  --muted: #9ab0cb;
  --accent: #ff8a1f;
  --accent-2: #2ca7ff;
  --danger: #ff5f6d;
  --success: #38d39f;
  --shadow: 0 18px 40px rgba(0,0,0,0.35);
  font-family: Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(44,167,255,0.18), transparent 30%),
    radial-gradient(circle at top left, rgba(255,138,31,0.18), transparent 30%),
    linear-gradient(180deg, #06101b 0%, #091625 100%);
}

body {
  min-height: 100vh;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

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

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

.login-logo,
.brand {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.login-logo span,
.brand span {
  color: var(--accent);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  min-height: 100vh;
  background: rgba(5, 11, 19, 0.92);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
}

.userbox {
  padding: 16px;
  background: var(--panel-2);
  border-radius: 18px;
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

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

.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.nav-btn.active,
.nav-btn:hover {
  background: linear-gradient(90deg, rgba(255,138,31,0.15), rgba(44,167,255,0.12));
  border-color: var(--line);
}

.content {
  padding: 26px;
}

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

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

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

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

.stat-card,
.section-card {
  padding: 20px;
}

.stat-number {
  font-size: 34px;
  font-weight: 900;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  padding: 14px 15px;
  outline: none;
}

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

button {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  background: linear-gradient(90deg, var(--accent), #ff6b00);
}

button.secondary {
  background: linear-gradient(90deg, var(--accent-2), #256fff);
}

button.ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
}

button.danger {
  background: linear-gradient(90deg, #ff5f6d, #ff3d5a);
}

button.small {
  padding: 9px 12px;
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #ffb46b;
  font-size: 13px;
  font-weight: 800;
}

.notice {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
}

.notice.error {
  color: #ff9ea8;
}

.notice.success {
  color: #8ee7c4;
}

.tag {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag.active,
.tag.high,
.tag.enabled {
  background: rgba(255,95,109,0.12);
  color: #ff9ea8;
}

.tag.removed,
.tag.confirmed,
.tag.inactive,
.tag.disabled {
  background: rgba(56,211,159,0.12);
  color: #8ee7c4;
}

.tag.pending,
.tag.medium,
.tag.online {
  background: rgba(255,138,31,0.12);
  color: #ffc38f;
}

.tag.offline {
  background: rgba(255,255,255,0.08);
  color: #c9d4e5;
}

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

.permission-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

pre.json-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d6e2f0;
}

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

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

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

  .grid.stats,
  .form-grid,
  .form-grid.three,
  .permissions-grid {
    grid-template-columns: 1fr;
  }
}
