:root {
  --smart-blue: #586BA4;
  --french-blue: #324376;
  --light-gold: #F5DD90;
  --tangerine: #F68E5F;
  --coral: #F76C5E;
  --bg: #f8edc0;
  --panel: #fff9e5;
  --panel-strong: #fef2c6;
  --ink: #26345f;
  --muted: #69728f;
  --line: rgba(50, 67, 118, 0.18);
  --shadow: 0 22px 70px rgba(50, 67, 118, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(88, 107, 164, 0.28), transparent 28rem),
    radial-gradient(circle at 88% 0%, rgba(246, 142, 95, 0.20), transparent 26rem),
    linear-gradient(135deg, #fff7dc, var(--bg));
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  min-height: 100vh;
}

main {
  margin: 0 auto;
  max-width: 1440px;
  padding: 30px;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(32px, 5vw, 58px); letter-spacing: -0.065em; line-height: 0.95; }
h2 { font-size: 24px; letter-spacing: -0.035em; margin-bottom: 10px; }

.eyebrow {
  color: var(--smart-blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.muted { color: var(--muted); }
.section-gap { margin-top: 18px; }

.topbar {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.actions, .device-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.hero-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(320px, 1.8fr) repeat(3, minmax(180px, 1fr));
}

.hero-card,
.metric-card,
.card {
  background: rgba(255, 250, 240, 0.9);
  border: 1px solid rgba(221, 207, 184, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card {
  background:
    linear-gradient(135deg, rgba(50, 67, 118, 0.98), rgba(88, 107, 164, 0.92)),
    var(--french-blue);
  color: white;
  min-height: 170px;
  padding: 26px;
}

.hero-card .eyebrow { color: var(--light-gold); }
.hero-card p { color: rgba(255,255,255,0.76); margin-top: 12px; max-width: 620px; }

.metric-card {
  min-height: 170px;
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  border-radius: 999px;
  content: "";
  height: 92px;
  opacity: 0.16;
  position: absolute;
  right: -24px;
  top: -28px;
  width: 92px;
}

.metric-card.good::after { background: var(--smart-blue); }
.metric-card.warn::after { background: var(--tangerine); }
.metric-card.bad::after { background: var(--coral); }

.metric {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -0.07em;
  line-height: 0.95;
}

.metric-label {
  font-size: 17px;
  font-weight: 900;
  margin-top: 12px;
}

.metric-hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.card {
  padding: 20px;
}

.card.compact {
  padding: 18px;
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: 1.4fr 220px 240px 160px;
  margin-top: 18px;
}

.section-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

input, select, textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font: inherit;
  padding: 12px 13px;
  width: 100%;
}

textarea { min-height: 78px; resize: vertical; }

label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

button {
  border: 0;
  border-radius: 14px;
  color: white;
  cursor: pointer;
  font-weight: 900;
  padding: 12px 15px;
  transition: transform 120ms ease, opacity 120ms ease;
}

button:hover { transform: translateY(-1px); }
button.primary { background: var(--french-blue); }
button.secondary { background: var(--smart-blue); }
button.danger { background: var(--coral); }
button.ghost {
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--line);
  color: var(--ink);
}

.device-list {
  display: grid;
  gap: 13px;
}

.device-card {
  background: rgba(255,255,255,0.56);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
}

.device-card.online {
  border-color: rgba(88, 107, 164, 0.56);
  box-shadow: inset 4px 0 0 rgba(88, 107, 164, 0.86);
}

.device-main {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.device-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.dot {
  border-radius: 50%;
  display: inline-block;
  height: 11px;
  width: 11px;
}

.dot.on { background: var(--smart-blue); box-shadow: 0 0 0 6px rgba(88, 107, 164, 0.18); }
.dot.off { background: #b8afa0; }

.device-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.mini-stat {
  background: rgba(255,250,240,0.82);
  border: 1px solid rgba(221, 207, 184, 0.72);
  border-radius: 16px;
  padding: 11px;
}

.mini-stat > span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.mini-stat strong {
  display: block;
  font-size: 14px;
  line-height: 1.22;
}

.mini-stat strong span {
  color: var(--muted);
  font-weight: 600;
}

.note {
  background: rgba(88, 107, 164, 0.10);
  border-radius: 14px;
  color: var(--muted);
  margin-top: 12px;
  padding: 10px 12px;
}

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 10px;
}

.ACTIVE { background: rgba(88, 107, 164, 0.18); color: var(--french-blue); }
.TRIAL { background: rgba(245, 221, 144, 0.78); color: var(--french-blue); }
.TEST_ONLY { background: rgba(246, 142, 95, 0.25); color: var(--french-blue); }
.SUSPENDED { background: rgba(246, 142, 95, 0.34); color: #7a3517; }
.EXPIRED, .REVOKED { background: rgba(247, 108, 94, 0.30); color: #84251d; }

.event-list {
  display: grid;
  gap: 10px;
}

.event-row {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 0.75fr) 1fr;
  padding: 12px 0;
}

pre {
  background: var(--french-blue);
  border-radius: 14px;
  color: #e6f0f3;
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.login-shell {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: 1.2fr 420px;
  margin: 10vh auto 0;
  max-width: 980px;
}

.brand-panel {
  background:
    linear-gradient(135deg, rgba(50, 67, 118, 0.98), rgba(88, 107, 164, 0.92)),
    var(--french-blue);
  border-radius: 28px;
  box-shadow: var(--shadow);
  color: white;
  padding: 34px;
}

.brand-panel p:last-child {
  color: rgba(255,255,255,0.76);
  margin-top: 16px;
}

.login {
  align-self: stretch;
}

.error, .success {
  border-radius: 14px;
  margin-bottom: 14px;
  padding: 11px 13px;
}

.error {
  background: rgba(247, 108, 94, 0.22);
  border: 1px solid rgba(247, 108, 94, 0.45);
  color: #84251d;
}

.success {
  background: rgba(88, 107, 164, 0.16);
  border: 1px solid rgba(88, 107, 164, 0.32);
  color: var(--french-blue);
}

@media (max-width: 1100px) {
  .hero-grid, .toolbar, .device-meta, .grid-2, .login-shell {
    grid-template-columns: 1fr;
  }

  .device-main {
    display: grid;
  }
}

@media (max-width: 720px) {
  main { padding: 16px; }
  .topbar { display: grid; }
  .device-title { font-size: 20px; }
  .event-row { grid-template-columns: 1fr; }
}
