:root {
  --ink: #17211c;
  --muted: #60716a;
  --line: #d9e2dc;
  --paper: #f8faf6;
  --panel: #ffffff;
  --field: #eef4ef;
  --forest: #24483a;
  --moss: #6f8b55;
  --signal: #247d7a;
  --amber: #b77420;
  --danger: #a53c35;
  --shadow: 0 18px 50px rgba(31, 47, 40, 0.12);
  font-family: "IBM Plex Sans", "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(36, 72, 58, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(36, 72, 58, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: #13241d;
  color: #f7fbf6;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #dce9cd;
  color: #13241d;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b7c9bd;
  font-size: 0.84rem;
}

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

.nav-item {
  border: 0;
  padding: 12px 14px;
  text-align: left;
  color: #dbe9df;
  background: transparent;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.workspace {
  padding: 28px;
  min-width: 0;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--signal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 0.96;
  max-width: 760px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h3 {
  font-size: 1rem;
}

.search {
  width: min(520px, 100%);
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 16px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 1px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  background: var(--line);
}

.status-strip article {
  background: rgba(255, 255, 255, 0.82);
  padding: 18px;
}

.metric {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--forest);
}

.status-strip span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.phase-pill {
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--forest);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.building-grid,
.system-list,
.sync-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.building-card,
.system-card,
.sync-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 16px;
  min-height: 150px;
}

.building-card strong,
.system-card strong,
.sync-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.meta-line {
  color: var(--muted);
  font-size: 0.88rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tag {
  background: var(--field);
  color: var(--forest);
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 700;
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 300px;
  gap: 18px;
}

.plan-board {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  min-height: 520px;
  padding: 14px;
  border: 2px solid var(--forest);
  background: #f4f7f1;
  box-shadow: var(--shadow);
}

.room {
  display: grid;
  place-items: center;
  border: 1px solid #9ead9e;
  background:
    repeating-linear-gradient(45deg, rgba(36, 72, 58, 0.06) 0 8px, transparent 8px 16px),
    #ffffff;
  color: var(--forest);
  font-weight: 800;
}

.room-a {
  grid-column: span 1;
}

.room-b {
  grid-column: span 2;
}

.room-c {
  background-color: #eef4e8;
}

.room-d {
  grid-column: span 2;
}

.asset-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 6px rgba(36, 125, 122, 0.18);
  cursor: pointer;
}

.asset-pin.warning {
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(183, 116, 32, 0.18);
}

.detail-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: var(--field);
  color: var(--forest);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-weight: 800;
}

.sync-status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--signal);
}

.sync-status.stale::before {
  background: var(--amber);
}

.sync-status.error::before {
  background: var(--danger);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
    padding: 10px 6px;
  }

  .topbar,
  .section-heading {
    flex-direction: column;
  }

  .status-strip,
  .building-grid,
  .system-list,
  .sync-board,
  .plan-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .workspace {
    padding: 18px;
  }

  .rail {
    padding: 18px;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  .status-strip {
    grid-template-columns: 1fr 1fr;
  }

  .plan-board {
    min-height: 380px;
  }
}
