/* Virtual City — fictional demo. No external fonts, images or CDNs. */

:root {
  --bg: #070f1c;
  --bg-glow: #0f2038;
  --rail: #091425;
  --panel: #0d1b2e;
  --panel-2: #112339;
  --line: #1d3350;
  --line-soft: rgba(29, 51, 80, 0.55);
  --text: #dbe6f4;
  --text-strong: #edf4fc;
  --muted: #8ba3bf;
  --dim: #647b96;
  --gold: #d8b45c;
  --gold-2: #f0d494;
  --gold-deep: #b08a34;
  --green: #4fbd8b;
  --red: #d97b7b;
  --radius: 12px;
  --shadow: 0 22px 48px -26px rgba(0, 0, 0, 0.95);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 18% -8%, var(--bg-glow) 0%, rgba(7, 15, 28, 0) 62%),
    radial-gradient(900px 620px at 92% 8%, #0d1e33 0%, rgba(7, 15, 28, 0) 58%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }

/* ---------- demo banner ---------- */
.demo-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 18px;
  background: linear-gradient(180deg, #13253d, #0d1a2b);
  border-bottom: 1px solid rgba(216, 180, 92, 0.28);
  color: #a9bdd4;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  text-align: center;
}
.demo-strip strong { color: var(--gold-2); font-weight: 600; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 22px;
  background: rgba(8, 17, 30, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.rail-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0d1b2e;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}
.rail-toggle:hover { border-color: var(--gold-deep); }

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.22em;
}
.brand-sub {
  color: var(--dim);
  font-size: 8.5px;
  letter-spacing: 0.3em;
  margin-top: 2px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0e1d31;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip--demo {
  border-color: rgba(216, 180, 92, 0.4);
  background: rgba(216, 180, 92, 0.1);
  color: var(--gold-2);
}
.chip--warn { border-color: rgba(217, 123, 123, 0.45); color: #eab6b6; }
.chip--ok { border-color: rgba(79, 189, 139, 0.4); color: #9adcbc; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(160deg, #24405f, #14243a);
  border: 1px solid #34506e;
  color: var(--gold-2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { color: var(--text-strong); font-size: 12.5px; font-weight: 600; }
.user-meta small { color: var(--dim); font-size: 10.5px; }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  align-items: start;
}

/* ---------- left rail ---------- */
.rail {
  position: sticky;
  top: 64px;
  height: calc(100vh - 94px);
  overflow-y: auto;
  padding: 20px 12px 32px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0a1728 0%, #081324 100%);
}
.rail::-webkit-scrollbar { width: 8px; }
.rail::-webkit-scrollbar-thumb { background: #16293f; border-radius: 8px; }

.nav-label {
  padding: 0 12px 10px;
  color: #556d88;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: #b9cbe0;
  font-family: inherit;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.nav-item .ico { font-size: 16px; width: 20px; text-align: center; flex: none; }
.nav-item:hover { background: #122339; color: #dce8f6; }
.nav-item.is-active {
  background: linear-gradient(180deg, #e2c077 0%, #c89f4c 100%);
  border-color: #e8cd8d;
  color: #16233a;
  font-weight: 600;
  box-shadow: 0 10px 22px -14px rgba(216, 180, 92, 0.9);
}
.nav-item .lock { margin-left: auto; font-size: 10px; opacity: 0.55; }

/* ---------- main ---------- */
.main {
  min-height: calc(100vh - 94px);
  padding: 26px 30px 56px;
  outline: none;
}
.main > * { animation: fade 0.22s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 22px;
}
.page-head h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.page-head .sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.page-head .tools { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search input {
  width: 290px;
  padding: 9px 12px 9px 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0c1a2c;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.search input::placeholder { color: #5f7691; }
.search input:focus { border-color: rgba(216, 180, 92, 0.55); box-shadow: 0 0 0 3px rgba(216, 180, 92, 0.1); }
.search .glyph {
  position: absolute;
  left: 11px;
  color: #5f7691;
  font-size: 12px;
  pointer-events: none;
}

/* ---------- agent city (CSS-only simulation) ---------- */
.city {
  position: relative;
  height: 340px;
  margin-bottom: 4px;
  border: 1px solid #1c3350;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(56, 189, 196, 0.18), transparent 62%),
    linear-gradient(180deg, #071322 0%, #08111f 55%, #050b14 100%);
}
.city-towers {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 82%;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0 16px;
}
.tower {
  position: relative;
  flex: 1;
  height: var(--h);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1px;
  padding: 8px;
  border: 1px solid rgba(120, 220, 230, 0.18);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, hsl(192 58% 17%), hsl(202 70% 7%));
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.55);
}
.tower::after {
  content: "";
  position: absolute;
  inset: 8px 8px 34px;
  border-radius: 3px;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(140, 235, 240, 0.16) 0 2px,
    transparent 2px 9px
  );
}
.tower-label,
.tower-load {
  position: relative;
  z-index: 2;
}
.tower-label {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #d3ecf2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tower-load {
  font-size: 9.5px;
  color: #6f9bab;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.city-street {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 13%;
  background: linear-gradient(180deg, rgba(6, 18, 30, 0.25), rgba(3, 9, 16, 0.96));
  border-top: 1px solid rgba(120, 220, 230, 0.16);
}
.agent {
  position: absolute;
  top: var(--y);
  left: 4%;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 46%;
  animation: agent-walk var(--dur) ease-in-out infinite alternate;
  animation-delay: var(--delay);
  will-change: left;
}
.agent-dot {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #04212a;
  background: linear-gradient(160deg, #9ff6f2, #38b8c4);
  box-shadow: 0 0 12px rgba(90, 230, 235, 0.55);
}
.agent-task {
  font-size: 10.5px;
  color: #a9c9d4;
  padding: 2px 7px;
  border: 1px solid rgba(120, 220, 230, 0.18);
  border-radius: 999px;
  background: rgba(6, 16, 28, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes agent-walk {
  from { left: 2%; }
  to { left: 78%; }
}
@media (prefers-reduced-motion: reduce) {
  .agent { animation: none; }
}
@media (max-width: 720px) {
  .city { height: 280px; }
  .agent-task { display: none; }
}

/* ---------- dashboard banner ---------- */
.dash-hero {
  position: relative;
  height: 230px;
  margin-bottom: 24px;
  border: 1px solid #1c3350;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.dash-hero img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dash-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 17, 30, 0.94) 0%, rgba(8, 17, 30, 0.62) 46%, rgba(8, 17, 30, 0.12) 100%),
    linear-gradient(180deg, rgba(8, 17, 30, 0) 55%, rgba(8, 17, 30, 0.6) 100%);
}
.dash-hero .hero-body { z-index: 2; }

/* ---------- dashboard grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid #1c3350;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #112339 0%, #0b1929 100%);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font-family: inherit;
  color: inherit;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(216, 180, 92, 0.45);
  box-shadow: 0 26px 52px -24px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(216, 180, 92, 0.08);
}
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.card-thumb {
  position: relative;
  height: 156px;
  overflow: hidden;
  border-bottom: 1px solid rgba(29, 51, 80, 0.8);
}
.card-thumb .scene { position: absolute; inset: 0; }
.card-thumb .scene svg { display: block; width: 100%; height: 100%; }
.card-thumb .scene img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 17, 30, 0.05) 40%, rgba(11, 25, 41, 0.92) 100%);
}
.thumb-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(216, 180, 92, 0.4);
  background: rgba(9, 18, 31, 0.82);
  color: var(--gold-2);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.thumb-badge--shared { border-color: rgba(120, 170, 220, 0.45); color: #a9c9e8; }

.card-body { padding: 15px 17px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.005em;
}
.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  min-height: 38px;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 6px;
}
.card-open { color: var(--gold); font-size: 12.5px; font-weight: 600; }
.card:hover .card-open { color: var(--gold-2); }
.card-lock { color: #5d7590; font-size: 11px; display: inline-flex; align-items: center; gap: 5px; }

/* ---------- dashboard bands ---------- */
.group { margin: 0 0 30px; }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
}
.group-head h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.group-count {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.group-note { margin-left: auto; color: var(--dim); font-size: 11.5px; text-align: right; }
@media (max-width: 760px) { .group-note { display: none; } }

/* ---------- dashboard profile switch ---------- */
.profile-switch { margin: 0 0 16px; }
.profile-switch select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0b1726;
  color: var(--text-strong);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.profile-switch select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.profile-note { margin: 7px 2px 0; color: var(--dim); font-size: 11px; line-height: 1.4; }

.empty {
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* ---------- workspace ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.back:hover { color: var(--gold); }

.hero {
  position: relative;
  height: 248px;
  border-radius: 14px;
  border: 1px solid #1c3350;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero .scene { position: absolute; inset: 0; }
.hero .scene svg { width: 100%; height: 100%; display: block; }
.hero .scene img { width: 100%; height: 100%; display: block; object-fit: cover; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 17, 30, 0.94) 0%, rgba(8, 17, 30, 0.66) 42%, rgba(8, 17, 30, 0.18) 100%),
    linear-gradient(180deg, rgba(8, 17, 30, 0) 55%, rgba(8, 17, 30, 0.55) 100%);
}
.hero-body { position: absolute; z-index: 2; left: 26px; bottom: 22px; right: 26px; }
.hero-eyebrow {
  color: var(--gold);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.hero h1 { margin: 0 0 6px; color: #f2f7fd; font-size: 26px; font-weight: 600; }
.hero p { margin: 0 0 12px; max-width: 560px; color: #a9bdd4; font-size: 13px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 18px;
}
.tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0c1a2c;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.tab:hover { color: var(--text); border-color: #2a4a6d; }
.tab.is-active {
  border-color: rgba(216, 180, 92, 0.6);
  background: rgba(216, 180, 92, 0.12);
  color: var(--gold-2);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}
.stat {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(180deg, #0f2034, #0b1828);
}
.stat .label {
  color: var(--dim);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.stat .value {
  color: var(--text-strong);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 4px;
}
.stat .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #0e1d31, #0b1828);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { margin: 0; color: var(--text-strong); font-size: 14.5px; font-weight: 600; }
.panel-head .hint { margin-left: auto; color: var(--dim); font-size: 11.5px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th {
  padding: 10px 18px;
  color: #6e88a4;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 22, 37, 0.6);
}
td {
  padding: 12px 18px;
  color: #c8d7e8;
  font-size: 13px;
  border-bottom: 1px solid rgba(29, 51, 80, 0.45);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(216, 180, 92, 0.045); }
td:first-child { color: #e4edf8; font-weight: 500; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 13px;
  padding: 16px;
}
.mini {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #122338, #0d1a2b);
}
.mini h3 { margin: 0 0 4px; color: var(--text-strong); font-size: 13.5px; font-weight: 600; }
.mini .meta { color: var(--gold); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.mini p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #93a9c2;
  font-size: 10.5px;
}

.policy-list { margin: 0; padding: 8px 18px 14px; list-style: none; }
.policy-list li {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(29, 51, 80, 0.4);
  color: #c3d2e4;
  font-size: 12.5px;
  line-height: 1.55;
}
.policy-list li:last-child { border-bottom: none; }
.policy-list .mark { color: var(--gold); flex: none; }

.form { padding: 16px 18px 20px; display: grid; gap: 12px; max-width: 620px; }
.field { display: grid; gap: 5px; }
.field label {
  color: var(--dim);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.field input, .field textarea, .field select {
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0a1728;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(216, 180, 92, 0.55);
  box-shadow: 0 0 0 3px rgba(216, 180, 92, 0.09);
}
.btn {
  justify-self: start;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid #e8cd8d;
  background: linear-gradient(180deg, #e2c077, #c89f4c);
  color: #16233a;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn--ghost {
  border: 1px solid var(--line);
  background: #0e1d31;
  color: var(--text);
  font-weight: 500;
}

.footnote { margin: 18px 0 0; color: #58708a; font-size: 11.5px; }

/* ---------- gate ---------- */
.gate { display: grid; place-items: center; min-height: 60vh; padding: 20px 0; }
.gate-card {
  width: min(600px, 100%);
  padding: 34px 34px 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(520px 240px at 50% -20%, rgba(216, 180, 92, 0.12), transparent 70%),
    linear-gradient(180deg, #102034, #0b1828);
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(216, 180, 92, 0.45);
  background: rgba(216, 180, 92, 0.1);
  font-size: 24px;
}
.gate-card h2 { margin: 0 0 8px; color: var(--text-strong); font-size: 21px; font-weight: 600; }
.gate-card p { margin: 0 auto 14px; max-width: 470px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.gate-notes {
  margin: 0 auto 20px;
  padding: 0;
  max-width: 470px;
  list-style: none;
  text-align: left;
}
.gate-notes li {
  display: flex;
  gap: 9px;
  padding: 7px 0;
  color: #a9bdd4;
  font-size: 12px;
  border-top: 1px solid rgba(29, 51, 80, 0.5);
}
.gate-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 80;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid rgba(216, 180, 92, 0.45);
  background: #102034;
  color: #dbe6f4;
  font-size: 12.5px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
  animation: toastIn 0.2s ease both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 900px) {
  .rail-toggle { display: inline-block; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed;
    z-index: 50;
    top: 94px;
    left: 0;
    width: 280px;
    height: calc(100vh - 94px);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.9);
  }
  .rail.is-open { transform: none; }
  .main { padding: 20px 18px 48px; }
  .page-head .tools { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .search { flex: 1; }
  .hero { height: 210px; }
  .user-meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------- machine console (demo) ----------------
   Self-contained: the console does not borrow the site palette. It is an
   instrument panel, so it has its own phosphor scale and its own bezel. */

.term {
  --tg: #31e878;
  --tg-soft: #8ff0b4;
  --tg-dim: #1f8a4d;
  --tamber: #ffb84d;
  --tblue: #5aa9ff;
  position: relative;
  padding: 10px;
  border: 1px solid #1c6b3d;
  border-radius: 14px;
  overflow: hidden;
  color: var(--tg-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  background: radial-gradient(120% 90% at 50% 0%, #07190f 0%, #040d08 60%, #020705 100%);
  box-shadow: inset 0 0 60px rgba(24, 130, 68, .12), 0 0 0 1px rgba(8, 34, 20, .9), 0 24px 50px -34px #000;
}

.term::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
  opacity: .45;
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, .55) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid rgba(31, 138, 77, .5);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #6ef0a2;
}

.term-bar .led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tg);
  box-shadow: 0 0 9px #35f07d;
  animation: termPulse 2.6s ease-in-out infinite;
}

.term-spacer { flex: 1 1 auto; }
.term-count { color: #4fbf7c; letter-spacing: .08em; }
.term-count b { color: #b6ffd2; font-weight: 600; }
.term-count--warn b { color: var(--tamber); }

.term-grid {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 176px;
  gap: 12px;
  height: 520px;
  padding: 10px 4px;
}

.term-log {
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.6;
  white-space: pre;
  color: #5fe08c;
  -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 84%, transparent 100%);
  border-right: 1px solid rgba(31, 138, 77, .3);
  padding-right: 8px;
  text-shadow: 0 0 8px rgba(49, 232, 120, .35);
}

.term-map { position: relative; min-height: 100%; }
.term-links { position: absolute; inset: 0; width: 100%; height: 100%; }
.term-node {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  transform: translate(-50%, -50%);
  width: 108px;
  padding: 6px 6px 4px;
  border: 1px solid rgba(49, 232, 120, .45);
  border-radius: 4px;
  background: rgba(4, 22, 13, .86);
  box-shadow: 0 0 18px -6px rgba(49, 232, 120, .55), inset 0 0 18px rgba(49, 232, 120, .08);
  text-align: center;
}

.term-cells {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.term-cells .cell {
  display: block;
  height: 9px;
  border: 1px solid rgba(49, 232, 120, .35);
  background: rgba(49, 232, 120, .10);
  transition: background .25s ease, box-shadow .25s ease;
}

.term-cells .cell.is-lit {
  background: rgba(90, 255, 160, .62);
  box-shadow: 0 0 7px rgba(60, 255, 140, .75);
}

.term-node-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #a8ffca; }
.term-node-role { font-size: 9px; letter-spacing: .04em; color: #4fbf7c; margin-top: 2px; }

.term-node.tone-amber { border-color: rgba(255, 184, 77, .55); box-shadow: 0 0 18px -6px rgba(255, 184, 77, .6), inset 0 0 18px rgba(255, 184, 77, .1); }
.term-node.tone-amber .cell { border-color: rgba(255, 184, 77, .4); background: rgba(255, 184, 77, .12); }
.term-node.tone-amber .term-node-label { color: #ffd39a; }
.term-node.tone-amber .term-node-role { color: #c9944a; }

.term-node.tone-blue { border-color: rgba(90, 169, 255, .5); box-shadow: 0 0 18px -6px rgba(90, 169, 255, .55), inset 0 0 18px rgba(90, 169, 255, .1); }
.term-node.tone-blue .cell { border-color: rgba(90, 169, 255, .4); background: rgba(90, 169, 255, .12); }
.term-node.tone-blue .term-node-label { color: #b9dcff; }
.term-node.tone-blue .term-node-role { color: #6ba6dd; }

.term-gauges {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 10px;
  align-content: start;
  padding-left: 6px;
  border-left: 1px solid rgba(31, 138, 77, .3);
}

.term-gauge { display: flex; flex-direction: column; gap: 4px; }
.term-gauge .g-label { font-size: 9px; letter-spacing: .16em; color: #4fbf7c; }
.term-gauge .g-track {
  position: relative;
  height: 82px;
  border: 1px solid rgba(31, 138, 77, .55);
  background: linear-gradient(180deg, rgba(49, 232, 120, .04), rgba(49, 232, 120, .01));
  display: flex;
  align-items: flex-end;
}
.term-gauge .g-fill {
  width: 100%;
  height: 40%;
  background: linear-gradient(180deg, #a4ffc8, #31e878 45%, #0f7c42);
  box-shadow: 0 0 10px -2px rgba(49, 232, 120, .8);
  transition: height .5s linear;
}
.term-gauge .g-val { font-size: 10px; color: #b6ffd2; text-align: right; }

.term-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 6px 2px;
  border-top: 1px solid rgba(31, 138, 77, .45);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #3f9f66;
}

@keyframes termPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@media (max-width: 900px) {
  .term-grid { grid-template-columns: 1fr; height: auto; }
  .term-log { height: 150px; border-right: 0; border-bottom: 1px solid rgba(31, 138, 77, .3); padding-bottom: 8px; }
  .term-map { min-height: 320px; }
  .term-gauges { grid-template-columns: repeat(4, 1fr); border-left: 0; padding-left: 0; }
  .term-foot { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .term-bar .led { animation: none; }
  .term-gauge .g-fill, .term-cells .cell { transition: none; }
}

/* Per-machine accent: the bezel is constant, the phosphor shifts so a glance
   tells you which unit you are looking at. */
.term--blue .term-bar { color: #a8d8ea; }
.term--blue .term-log { color: #7fc8e6; }
.term--blue .term-node-label { color: #c6e9f6; }
.term--blue .term-foot { color: #4f8ba6; }
.term--blue .led { background: #7fc8e6; box-shadow: 0 0 10px rgba(127, 200, 230, .85); }

/* Machine roster: the home base reads as one rack, not a list of links. */
.rack { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 10px; }
.rack-unit { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid rgba(216, 180, 92, .16); border-radius: 10px; background: rgba(10, 22, 38, .55); }
.rack-led { width: 7px; height: 7px; border-radius: 50%; background: #5fe08c; box-shadow: 0 0 8px rgba(95, 224, 140, .8); flex: none; }
.rack-led--blue { background: #7fc8e6; box-shadow: 0 0 8px rgba(127, 200, 230, .8); }
.rack-meta { display: flex; flex-direction: column; min-width: 0; }
.rack-unit strong { font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; }
.rack-unit small { font-size: 11px; color: var(--ink-dim, #8fa3bd); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rack-unit { font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rack-unit:hover { border-color: rgba(216, 180, 92, .42); }
