:root {
  --bg: #121410;
  --rail: rgba(20, 22, 18, 0.96);
  --surface: #ecebe4;
  --ink: #1c211b;
  --ink-soft: #5a6158;
  --accent: #2f5d62;
  --accent-2: #3d7a80;
  --brass: #b8863c;
  --ok: #2e7d5b;
  --warn: #a46a1f;
  --bad: #b3492f;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Source Sans 3", system-ui, sans-serif;
  color: var(--surface);
  background: linear-gradient(160deg, #10120f, #1a1c18 55%, #1e221c);
}

.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  height: 100vh;
}

.rail {
  background: var(--rail);
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 16px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.nav-item, .home-card {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.nav-item {
  color: rgba(236, 235, 228, 0.62);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 12px;
  border-left: 2px solid transparent;
  flex-shrink: 0;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--brass), #8f6a2d);
  clip-path: polygon(0 0, 100% 0, 100% 68%, 68% 100%, 0 100%);
}
.brand-name {
  font-family: "Oswald", sans-serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  line-height: 1;
}
.brand-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--brass);
  letter-spacing: 0.18em;
  margin-top: 4px;
}

.nav-item:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-item.is-active {
  color: #fff;
  border-left-color: var(--brass);
  background: rgba(184, 134, 60, 0.1);
}
.nav-kiosk {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 0;
  padding: 12px 12px;
  color: #f3e2b0 !important;
  border: 1px solid rgba(184, 134, 60, 0.55);
  border-left: 3px solid var(--brass);
  background: rgba(184, 134, 60, 0.16);
  cursor: pointer;
}
.nav-kiosk span {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(243, 226, 176, 0.72);
}
.nav-kiosk:hover,
.nav-kiosk.is-active {
  color: #fff !important;
  background: rgba(184, 134, 60, 0.32);
  border-color: var(--brass);
}
.module-frame:not([hidden]) {
  display: block !important;
  z-index: 3;
}

.context-card {
  flex-shrink: 0;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.context-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 10px;
}
.context-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 4px 0;
  color: rgba(236,235,228,0.55);
}
.context-row strong {
  color: #fff;
  font-weight: 600;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.context-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}
.linkish {
  appearance: none;
  border: 0;
  background: none;
  color: var(--brass);
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.linkish:hover { color: #d4a45a; }

.rail-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  font-size: 12px;
  color: rgba(236,235,228,0.5);
  flex-shrink: 0;
}
.mono { font-family: "IBM Plex Mono", monospace; }
.rail-foot.is-ok #status-dot { color: var(--ok); }
.rail-foot.is-warn #status-dot { color: var(--warn); }
.rail-foot.is-bad #status-dot { color: var(--bad); }

.stage {
  min-width: 0;
  min-height: 0;
  position: relative;
  background: #0e100d;
}

.home {
  padding: 48px 56px;
  max-width: 980px;
  animation: rise .55s ease both;
}
.eyebrow {
  margin: 0 0 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}
.home h1 {
  margin: 0 0 14px;
  font-family: "Oswald", sans-serif;
  font-size: clamp(40px, 6vw, 60px);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 0.95;
}
.lede {
  margin: 0 0 28px;
  font-size: 17px;
  line-height: 1.45;
  color: rgba(236,235,228,0.72);
  max-width: 42ch;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.home-card {
  color: var(--ink);
  background: linear-gradient(180deg, #f4f3ec, #e8e6dc);
  padding: 24px 20px;
  min-height: 180px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  transition: transform .2s ease;
}
.home-card:hover { transform: translateY(-3px); }
.home-card .kicker {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 14px;
}
.home-card h2 {
  margin: 0 0 8px;
  font-family: "Oswald", sans-serif;
  font-size: 26px;
}
.home-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
}

.module-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

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

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100vh; }
  .rail { border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.06); height: auto; overflow: visible; }
  .nav { flex-direction: row; flex-wrap: wrap; overflow: visible; flex: none; }
  .nav-kiosk { flex-direction: row; align-items: baseline; gap: 8px; width: auto; margin: 0; }
  .context-card { display: none; }
  .home { padding: 24px 18px; }
  .home-grid { grid-template-columns: 1fr; }
}
