:root {
  --bg: #091510;
  --bg2: #12231d;
  --panel: rgba(248, 244, 232, 0.94);
  --ink: #13211c;
  --muted: #617066;
  --brand: #177e5a;
  --brand-dark: #0d5a40;
  --brand-soft: rgba(23, 126, 90, 0.12);
  --line: rgba(19, 33, 28, 0.12);
  --danger: #b84c34;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Outfit, sans-serif;
  background:
    radial-gradient(circle at 18% 10%, rgba(244, 179, 71, 0.24), transparent 28rem),
    radial-gradient(circle at 90% 12%, rgba(23, 126, 90, 0.32), transparent 26rem),
    linear-gradient(135deg, var(--bg), var(--bg2) 60%, #f4b347 180%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.app-shell {
  width: min(1480px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px;
  animation: rise .55s ease both;
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 22px;
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise .55s ease both;
}

.main-area {
  display: grid;
  gap: 18px;
}

.brand-block h1 {
  font-size: 40px;
  margin: 0;
}

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

.mini-stat {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.mini-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  font-family: Space Grotesk, sans-serif;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  background: rgba(255,255,255,.55);
  border: 1px solid transparent;
}

.sidebar-nav a:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.device-card {
  padding: 14px;
  box-shadow: none;
  background: rgba(255,255,255,.56);
}

.compact-head {
  align-items: center;
  margin-bottom: 10px;
}

.compact-head h2 {
  margin: 0;
  font-size: 16px;
}

.compact-head button {
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.device-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.device-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.68);
}

.device-item strong,
.device-item code {
  display: block;
  overflow-wrap: anywhere;
}

.device-item code {
  margin-top: 4px;
  color: var(--brand-dark);
  font-size: 12px;
}

.full { width: 100%; }

.tiny { font-size: 12px; }

.eyebrow {
  color: var(--brand-dark);
  font: 700 13px Space Grotesk, sans-serif;
  letter-spacing: .18em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1, h2 {
  font-family: Space Grotesk, sans-serif;
  letter-spacing: -0.04em;
}

h1 { font-size: clamp(42px, 8vw, 78px); line-height: .92; margin: 0; }
h2 { margin: 0 0 18px; font-size: 24px; }

.muted { color: var(--muted); margin: 10px 0 0; }
.status-pill {
  border-radius: 999px;
  padding: 12px 18px;
  color: #fff;
  background: var(--brand-dark);
  font-weight: 800;
  white-space: nowrap;
}

.grid { display: grid; gap: 18px; margin-top: 18px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.two { grid-template-columns: 1fr 1fr; }
.stat { padding: 22px; }
.stat span { color: var(--muted); font-weight: 700; }
.stat strong { display: block; font-size: 42px; margin-top: 8px; }

.form, .panel { padding: 24px; }
label { display: grid; gap: 8px; margin-bottom: 14px; font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255,255,255,.72);
  font: inherit;
  outline: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(29, 143, 99, .15); }

button, .link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  color: #fff;
  background: var(--brand);
  font: 800 15px Outfit, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .link:hover { background: var(--brand-dark); }
.ghost { color: var(--brand-dark); background: rgba(29,143,99,.12); }
.ghost:hover { color: #fff; }
.hero-actions { display: flex; gap: 10px; align-items: center; }

.panel-head, .columns { display: flex; gap: 16px; justify-content: space-between; }
.columns > * { flex: 1; }
.list { display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.wide-list { max-height: 320px; }
.item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.62);
}
.item strong { display: block; font-size: 16px; margin-bottom: 4px; }
.item small { color: var(--muted); overflow-wrap: anywhere; }
.badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
  font-weight: 800;
}
.badge.failed { background: var(--danger); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  transform: translateY(120px);
  padding: 14px 18px;
  border-radius: 16px;
  color: #fff;
  background: #14231e;
  box-shadow: var(--shadow);
  transition: transform .25s ease;
}
.toast.show { transform: translateY(0); }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; width: min(100% - 14px, 1480px); }
  .sidebar { position: relative; min-height: auto; }
  .hero, .panel-head, .columns { flex-direction: column; align-items: stretch; }
  .stats, .two, .sidebar-stats { grid-template-columns: 1fr; }
}
