:root {
  color-scheme: dark;
  --bg: #0e1116;
  --panel: #161b22;
  --panel-alt: #0f141b;
  --border: #293241;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --accent: #4ea1ff;
  --accent-strong: #2e7fe0;
  --ok: #1faa72;
  --warn: #c58a1c;
  --danger: #d34c4c;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #0a0d12 0%, #10151d 100%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

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

.sidebar {
  padding: 28px 22px;
  border-right: 1px solid var(--border);
  background: rgba(12, 16, 22, 0.82);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #6ec9ff);
  color: #081018;
  font-weight: 700;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle,
.muted,
.page-subtitle {
  color: var(--muted);
}

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

.nav a {
  display: block;
  padding: 11px 13px;
  border-radius: 12px;
  color: var(--text);
}

.nav a.active,
.nav a:hover {
  background: rgba(78, 161, 255, 0.12);
}

.logout-form {
  margin-top: 28px;
}

.main {
  padding: 30px;
}

.main-public {
  display: grid;
  place-items: center;
}

.page-header {
  margin-bottom: 22px;
}

.page-header h1,
.panel-header h2,
.panel h2 {
  margin: 0 0 6px;
}

.panel,
.stat-card {
  background: rgba(22, 27, 34, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
  margin-bottom: 20px;
}

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

.auth-panel {
  width: min(420px, 100%);
}

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

.stat-card {
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
}

.button-row,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.button,
button,
input,
textarea,
select {
  border-radius: 12px;
  border: 1px solid var(--border);
  font: inherit;
}

.button,
button {
  padding: 11px 16px;
  cursor: pointer;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
}

.button.button-muted {
  background: #1f2733;
}

.button.button-danger {
  background: linear-gradient(180deg, #df5d5d 0%, #b53939 100%);
}

.button.button-block {
  width: 100%;
}

label {
  display: grid;
  gap: 7px;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 13px;
  background: var(--panel-alt);
  color: var(--text);
}

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

.narrow-form {
  max-width: 480px;
}

.alert {
  border-radius: 14px;
  padding: 13px 16px;
  margin-bottom: 18px;
}

.alert-danger {
  border: 1px solid rgba(211, 76, 76, 0.45);
  background: rgba(211, 76, 76, 0.12);
}

.alert-ok {
  border: 1px solid rgba(31, 170, 114, 0.45);
  background: rgba(31, 170, 114, 0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #283241;
  color: var(--text);
  font-size: 13px;
}

.badge-ok {
  background: rgba(31, 170, 114, 0.18);
  color: #86f0be;
}

.badge-warn {
  background: rgba(197, 138, 28, 0.18);
  color: #f4cc72;
}

.badge-danger {
  background: rgba(211, 76, 76, 0.18);
  color: #ff9c9c;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(41, 50, 65, 0.8);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.empty {
  text-align: center;
  color: var(--muted);
}

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

.detail-label {
  color: var(--muted);
  margin-bottom: 6px;
}

.detail-value {
  word-break: break-word;
}

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

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

  .stats-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
