:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-soft: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --btn: #2563eb;
  --btn-hover: #1d4ed8;
  --border: #374151;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(150deg, #0b1220, #111827);
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.stat-title {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-value.ok {
  color: var(--ok);
}

.stat-value.warn {
  color: var(--warn);
}

.stat-value.err {
  color: var(--err);
}

.buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 11px 12px;
  font-weight: 600;
  color: #fff;
  background: var(--btn);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--btn-hover);
}

.btn.secondary {
  background: #475569;
}

.btn.secondary:hover {
  background: #334155;
}

.console-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.console-title {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
}

.console {
  height: 380px;
  overflow-y: auto;
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.line {
  margin: 0 0 4px;
}

.line.info {
  color: #93c5fd;
}

.line.ok {
  color: #86efac;
}

.line.err {
  color: #fca5a5;
}

.line.warn {
  color: #fcd34d;
}

.hidden {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: min(680px, 100%);
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.modal-title {
  margin: 0 0 14px;
  font-size: 18px;
}

.field-label {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
  font-size: 13px;
}

.field-input,
.field-textarea {
  width: 100%;
  background: #020617;
  border: 1px solid #334155;
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: #3b82f6;
}

.field-textarea {
  min-height: 200px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

:root {
  --bg-main: #071120;
  --bg-grad-1: #0c1f3d;
  --bg-grad-2: #0a1730;
  --glass-bg: rgba(166, 208, 255, 0.08);
  --glass-border: rgba(150, 205, 255, 0.28);
  --text-main: #e7f3ff;
  --text-soft: #a9c7e7;
  --accent: #3b8cff;
  --accent-strong: #1f6ae6;
  --danger: #ff5f79;
  --success: #2cd0a0;
  --warn: #ffd166;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Inter", "Arial", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 10% 10%, rgba(59, 140, 255, 0.25), transparent 36%),
    radial-gradient(circle at 90% 85%, rgba(68, 179, 255, 0.18), transparent 42%),
    linear-gradient(150deg, var(--bg-grad-1), var(--bg-main) 50%, var(--bg-grad-2));
  background-size: 100% 100%, 100% 100%, 180% 180%;
  animation: driftBackground 18s ease-in-out infinite alternate;
  padding: 28px 16px;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    linear-gradient(transparent 95%, rgba(122, 194, 255, 0.06) 100%),
    linear-gradient(90deg, transparent 96%, rgba(122, 194, 255, 0.04) 100%);
  background-size: 100% 4px, 42px 100%;
  opacity: 0.28;
  mix-blend-mode: screen;
}

body::after {
  background: linear-gradient(120deg, transparent 20%, rgba(102, 186, 255, 0.1) 48%, transparent 74%);
  transform: translateX(-60%);
  animation: sweepLight 10s linear infinite;
}

.container {
  width: min(1180px, 100%);
  margin: 0 auto;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(185, 224, 255, 0.22);
  border-radius: 28px;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
  z-index: 1;
}

.container::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 27px;
  border: 1px solid rgba(168, 220, 255, 0.08);
  pointer-events: none;
}

.stats {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 18px;
}

.stat-card,
.console-wrap,
.buttons,
.modal {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.stat-card {
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stat-title {
  color: var(--text-soft);
  font-size: 13px;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  font-family: "Consolas", "Cascadia Mono", monospace;
  text-transform: uppercase;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #d9ecff;
  text-shadow: 0 0 16px rgba(67, 164, 255, 0.25);
}

.stat-value.warn {
  color: var(--warn);
}

.stat-value.ok {
  color: var(--success);
}

.stat-value.err {
  color: var(--danger);
}

.buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  margin-bottom: 18px;
  align-items: stretch;
}

.buttons .btn {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
}

.btn {
  appearance: none;
  border: 1px solid rgba(142, 206, 255, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  color: #f1f8ff;
  background: linear-gradient(160deg, rgba(59, 140, 255, 0.7), rgba(31, 106, 230, 0.75));
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow: 0 8px 18px rgba(16, 74, 164, 0.35);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(24, 97, 205, 0.45);
  filter: saturate(112%);
}

.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: linear-gradient(160deg, rgba(141, 174, 206, 0.28), rgba(118, 149, 177, 0.26));
  color: #d5e8ff;
}

.btn.danger {
  background: linear-gradient(160deg, rgba(255, 95, 121, 0.78), rgba(199, 39, 79, 0.76));
  border-color: rgba(255, 162, 181, 0.35);
  box-shadow: 0 8px 18px rgba(130, 23, 52, 0.35);
}

.btn.success {
  background: linear-gradient(160deg, rgba(44, 208, 160, 0.78), rgba(12, 143, 103, 0.74));
  border-color: rgba(122, 242, 205, 0.35);
  box-shadow: 0 8px 18px rgba(11, 108, 79, 0.32);
}

.console-wrap {
  padding: 16px;
}

.console-title {
  margin: 0 0 10px;
  font-size: 16px;
  color: #cde6ff;
  font-weight: 600;
  font-family: "Consolas", "Cascadia Mono", monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.console {
  min-height: 220px;
  max-height: 55vh;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid rgba(133, 200, 255, 0.2);
  background: rgba(4, 15, 32, 0.58);
  color: #d5eeff;
  padding: 12px;
  line-height: 1.5;
  font-family: "Consolas", "Cascadia Mono", monospace;
  font-size: 13px;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(94, 168, 255, 0.12), inset 0 0 18px rgba(31, 118, 224, 0.16);
}

.console::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: repeating-linear-gradient(
    to bottom,
    rgba(153, 214, 255, 0.04) 0px,
    rgba(153, 214, 255, 0.04) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.35;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 20, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: min(720px, 100%);
  padding: 18px;
  box-shadow: var(--shadow);
}

.modal-title {
  margin-top: 0;
  margin-bottom: 12px;
  color: #deefff;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #b8d9ff;
  font-size: 13px;
}

.field-input,
.field-textarea {
  width: 100%;
  border: 1px solid rgba(140, 194, 255, 0.35);
  border-radius: 12px;
  background: rgba(10, 28, 54, 0.7);
  color: #ecf7ff;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.45;
}

.field-input:focus,
.field-textarea:focus {
  border-color: rgba(86, 172, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(59, 140, 255, 0.2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

@keyframes driftBackground {
  0% {
    background-position: 0% 0%, 0% 0%, 0% 50%;
  }
  100% {
    background-position: 0% 0%, 0% 0%, 100% 50%;
  }
}

@keyframes sweepLight {
  0% {
    transform: translateX(-60%);
  }
  100% {
    transform: translateX(60%);
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  body::after {
    animation: none;
  }
}

@media (max-width: 760px) {
  body {
    padding: 14px 10px;
  }

  .container {
    padding: 14px;
    border-radius: 20px;
  }

  .buttons {
    grid-template-columns: 1fr;
    padding: 10px;
  }
}

@media (max-width: 1080px) and (min-width: 761px) {
  .buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.btn-logout {
  min-height: auto;
  width: auto;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.2;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.container-dashboard {
  gap: 14px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  margin-bottom: 4px;
}

.dashboard-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #eaf6ff;
  text-shadow: 0 0 20px rgba(83, 172, 255, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 8px;
}

@media (max-width: 760px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .logout-wrap {
    width: 100%;
  }
}
