:root {
  --bg: #0b0d13;
  --bg-deep: #070b16;
  --text: #e7ecf7;
  --muted: #9aa6bf;
  --accent: #f97316;
  --accent-2: #f59e0b;
  --danger: #ef4444;
  --card: rgba(15, 23, 42, 0.92);
  --card-strong: rgba(12, 18, 34, 0.95);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 18px 50px rgba(4, 10, 20, 0.55);
  --shadow-soft: 0 12px 30px rgba(4, 10, 20, 0.45);
  --app-header-height: 110px;
  --page-padding: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(1100px 700px at 10% -10%, rgba(249, 115, 22, 0.16), transparent 60%),
    radial-gradient(900px 600px at 90% -15%, rgba(245, 158, 11, 0.14), transparent 55%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
}

a:hover {
  color: #fff;
}

.grid-layer {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 0%, rgba(0, 0, 0, 0.9), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 18px 24px 0;
  pointer-events: none;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  border-radius: 18px;
  background: rgba(10, 14, 24, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.nav-left {
  flex: 0 0 auto;
}

.nav-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.nav-links {
  display: flex;
  gap: 18px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  flex-wrap: wrap;
  justify-content: center;
}

.nav-links a {
  color: inherit;
  text-decoration: none;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.logo-dot {
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.6);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--page-padding);
  position: relative;
  z-index: 1;
}

.page.full {
  max-width: none;
  padding: 16px 24px 24px;
  height: calc(100vh - var(--app-header-height));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page.center {
  min-height: calc(100vh - var(--app-header-height));
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.card.strong {
  background: var(--card-strong);
  border-color: var(--line-strong);
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #1f1306;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 600;
}

.pill-muted {
  background: rgba(15, 23, 42, 0.75);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.btn {
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1f1306;
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.35);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.btn.danger {
  background: linear-gradient(135deg, #f87171, var(--danger));
  color: #1f1306;
  box-shadow: 0 12px 28px rgba(239, 68, 68, 0.3);
}

.btn.small {
  padding: 8px 14px;
  font-size: 13px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

input,
select,
textarea {
  background: rgba(12, 18, 34, 0.9);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 1px solid rgba(249, 115, 22, 0.6);
}

.switch {
  position: relative;
  width: 52px;
  height: 26px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  cursor: pointer;
}

.switch-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f1f5f9;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.switch.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: rgba(249, 115, 22, 0.8);
}

.switch.on .switch-knob {
  transform: translateX(26px);
  background: #1f1306;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
}

.status-dot.off {
  background: #f87171;
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.5);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.logout-form {
  margin: 0;
}

@media (max-width: 900px) {
  .app-nav {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .nav-center {
    order: 3;
    flex-basis: 100%;
  }

  .nav-links {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 14px 16px 0;
  }

  .page {
    padding: 16px;
  }

  .page.full {
    padding: 12px 16px 16px;
  }
}
