:root {
  --bg: #0f1720;
  --panel: #171f29;
  --panel-hover: #1c2530;
  --border: #263140;
  --border-hover: #34445a;
  --text: #eef2f5;
  --text-muted: #8a97a3;
  --accent: #f2a541;      /* amber — status / signature */
  --accent-cool: #4fb0c6; /* teal — icon default state */
  --danger: #e2555c;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

/* faint schematic grid, signature backdrop texture */
.grid-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.18;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 90%);
}

.console-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px clamp(20px, 5vw, 56px) 20px;
  border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 14px; }

/* the NROF Drammen emblem carries its own frame, so no panel/border around it */
.logo-mark {
  width: 52px;
  height: 52px;
  display: block;
  flex-shrink: 0;
}

.header-text h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: 0.01em;
}

.eyebrow {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.clock {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* the link that toggles between the app portal and the org landing page */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.nav-toggle svg { width: 14px; height: 14px; flex-shrink: 0; }
.nav-toggle:hover, .nav-toggle:focus-visible {
  border-color: var(--accent-cool);
  color: var(--accent-cool);
  background: var(--panel-hover);
  outline: none;
}

main {
  position: relative;
  z-index: 1;
  padding: clamp(28px, 5vw, 56px);
}

/* the page is a stack of group sections; the tile grid lives inside each one */
.tiles {
  display: flex;
  flex-direction: column;
  gap: 38px;
  max-width: 1100px;
  margin: 0 auto;
}

.group-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.group-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin: 0;
  color: var(--text);
  white-space: nowrap;
}
.group-name::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 9px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: middle;
}

.group-desc {
  flex: 1;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.group-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  white-space: nowrap;
}
.group-count.all-online {
  color: var(--accent);
  border-color: rgba(242, 165, 65, 0.4);
}

.group-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.tile:hover, .tile:focus-visible {
  border-color: var(--border-hover);
  background: var(--panel-hover);
  transform: translateY(-2px);
  outline: none;
}
.tile:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-cool);
}

.tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.tile-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--accent-cool);
}
.tile-icon svg { width: 22px; height: 22px; }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 4px;
  background: var(--text-muted);
  flex-shrink: 0;
}
.status-dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(242, 165, 65, 0.6);
  animation: pulse 2.2s infinite;
}
.status-dot.offline { background: var(--danger); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(242, 165, 65, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(242, 165, 65, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 165, 65, 0); }
}

.tile-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0;
}

.tile-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.tile-meta {
  display: flex;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.tile-meta span {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
}

footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px clamp(20px, 5vw, 56px) 32px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 1100px;
  margin: 0 auto;
}

.dot-legend { display: flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; margin-left: 10px; margin-right: 3px;
}
.legend-dot.online { background: var(--accent); }
.legend-dot.offline { background: var(--danger); }
.legend-dot:first-child { margin-left: 0; }

@media (prefers-reduced-motion: reduce) {
  .status-dot.online { animation: none; }
  .tile { transition: none; }
}

@media (max-width: 700px) {
  /* narrow: the group blurb drops so name and counter stay on one line */
  .group-head { flex-wrap: wrap; }
  .group-desc { flex-basis: 100%; order: 3; }
  .group-count { margin-left: auto; }
}

@media (max-width: 520px) {
  .console-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}
