:root {
  --bg: #f2f5f8;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --text: #1f2a37;
  --muted: #607086;
  --line: #d9e2ec;
  --accent: #0f766e;
  --accent-soft: #d9f5f1;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #a16207;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%, #e4f8f4 0%, #f2f5f8 35%, #eef2ff 100%);
}

a {
  color: #0b4a8b;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(160deg, #0f766e 0%, #134e4a 100%);
  color: #e9f7f5;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.brand-subtitle {
  font-size: 13px;
  opacity: 0.9;
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 4px;
}

.brand-tag {
  font-size: 12px;
  opacity: 0.9;
}

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

.menu-link {
  color: #e5f5f3;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 500;
}

.menu-link:hover,
.menu-link.active {
  background: rgba(255, 255, 255, 0.16);
  text-decoration: none;
}

.sidebar-footer {
  margin-top: auto;
}

.user-card {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.1);
}

.user-name {
  font-size: 14px;
  font-weight: 600;
}

.user-role,
.user-login {
  font-size: 12px;
  opacity: 0.85;
}

.main-content {
  padding: 24px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 14px;
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
}

.card.narrow {
  max-width: 700px;
}

.card h3 {
  margin-top: 0;
}

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

.cards-grid.two {
  grid-template-columns: 1fr 1fr;
}

.stat .value {
  font-size: 30px;
  font-weight: 700;
  margin: 8px 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

.table.compact th,
.table.compact td {
  padding: 8px 6px;
}

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

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

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

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

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

input,
select,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  filter: brightness(0.95);
  text-decoration: none;
}

.btn-outline {
  background: var(--panel-soft);
  color: #124b45;
  border-color: #86ddd2;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fca5a5;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.actions-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  font-size: 12px;
  padding: 3px 9px;
  background: #e5e7eb;
  color: #374151;
}

.badge.ok {
  background: var(--accent-soft);
  color: #065f56;
}

.badge.fail {
  background: #fee2e2;
  color: #991b1b;
}

.badge.warn {
  background: #fef3c7;
  color: var(--warn);
}

.badge.info {
  background: #dbeafe;
  color: #1d4ed8;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 9px;
}

.env-pill.dev {
  background: #fef3c7;
  color: #92400e;
}

.env-pill.prod {
  background: #dcfce7;
  color: #166534;
}

.ok-text {
  color: #065f46;
  font-weight: 600;
}

.fail-text {
  color: #b91c1c;
  font-weight: 600;
}

.warn-text {
  color: var(--warn);
  font-weight: 600;
}

.alerts {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
}

.alert.success {
  border-color: #99f6e4;
  background: #ecfeff;
}

.alert.error {
  border-color: #fca5a5;
  background: #fff1f2;
}

.code-block {
  white-space: pre-wrap;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  font-family: "JetBrains Mono", "Cascadia Mono", monospace;
  margin: 0;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top left, #dff7f3 0%, #f2f5f8 40%, #e0e7ff 100%);
}

.login-box {
  width: min(420px, 92vw);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
}

.login-box h1 {
  margin: 0;
}

.login-meta {
  margin-top: 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cf-captcha-wrap {
  display: flex;
  justify-content: center;
}

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

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .grid-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .main-content {
    padding: 14px;
  }

  .cards-grid,
  .cards-grid.two,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
