:root {
  --charcoal: #1f1f1f;
  --ink: #1f1f1f;
  --cream: #f4ecdf;
  --card: #fbf6ee;
  --rust: #c2552b;
  --rust-text: #9e4120;
  --rust-btn: #a8461f;
  --rust-btn-hover: #8a3818;
  --rust-light: #e8875c;
  --muted: #554c44;
  --slab: Rockwell, "Rockwell Nova", "Roboto Slab", "Zilla Slab", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --working: #3d7a4a;
  --idle: #8a8176;
  --stuck: #b42318;
  --done: #c4a35a;
  --waiting: #c9a227;
  --stale: #e8875c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--charcoal); color: var(--cream); font-family: var(--sans); }
button, input { font: inherit; }
button { cursor: pointer; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse at top, rgba(194, 85, 43, 0.18), transparent 55%),
    var(--charcoal);
}
.gate[hidden], #app[hidden] { display: none !important; }
.gate-card {
  width: min(26rem, 100%);
  background: var(--cream);
  color: var(--ink);
  border: 2px solid var(--charcoal);
  border-top: 8px solid var(--rust);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.gate-logo { display: block; width: 8.5rem; height: auto; margin: 0 auto 1rem; }
.gate-card h1 {
  font-family: var(--slab);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
  margin: 0 0 .35rem;
  font-size: 1.85rem;
}
.gate-tag { text-align: center; color: var(--muted); margin: 0 0 1.25rem; }
.gate-card label { display: block; font-weight: 700; margin-bottom: .35rem; }
.gate-card input {
  width: 100%;
  border: 2px solid var(--charcoal);
  border-radius: 4px;
  padding: .7rem .75rem;
  background: #fff;
  color: var(--ink);
  margin-bottom: 1rem;
}
.gate-card button, #btn-simulate {
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: var(--rust-btn);
  color: #fff;
  font-weight: 700;
  padding: .75rem 1rem;
}
.gate-card button:hover, #btn-simulate:hover { background: var(--rust-btn-hover); }
.gate-error { color: var(--stuck); font-weight: 600; margin: .75rem 0 0; }

#app { position: fixed; inset: 0; overflow: hidden; }
#office-canvas { display: block; width: 100%; height: 100%; background: #1c1916; }

.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .65rem 1rem .65rem .75rem;
  background: linear-gradient(to bottom, rgba(31,31,31,.92), rgba(31,31,31,.55) 70%, transparent);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 10rem; }
.brand img { width: 2.5rem; height: 2.5rem; }
.brand strong {
  display: block;
  font-family: var(--slab);
  text-transform: uppercase;
  font-size: .95rem;
  letter-spacing: .06em;
  line-height: 1.1;
}
.brand span { display: block; color: var(--rust-light); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.clock { font-variant-numeric: tabular-nums; color: var(--cream); font-size: .85rem; opacity: .85; }
.text-btn {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(244, 236, 223, .35);
  border-radius: 4px;
  padding: .3rem .6rem;
  font-size: .8rem;
}
.text-btn:hover { border-color: var(--rust-light); color: var(--rust-light); }
.sim-badge {
  background: var(--rust);
  color: #fff;
  font-weight: 700;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .25rem .5rem;
  border-radius: 3px;
}
.feed-warning {
  flex: 1;
  background: #3a1c14;
  color: var(--stale);
  border: 1px solid var(--rust);
  padding: .4rem .7rem;
  font-size: .82rem;
  font-weight: 600;
}

.board {
  position: absolute;
  top: 4.4rem;
  right: .75rem;
  bottom: 5.2rem;
  width: min(20rem, 34vw);
  z-index: 4;
  background: rgba(31, 31, 31, .88);
  border: 1px solid rgba(244, 236, 223, .16);
  border-top: 5px solid var(--rust);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.board-head { padding: .7rem .85rem .5rem; border-bottom: 1px solid rgba(244,236,223,.12); }
.board-head h2 {
  font-family: var(--slab);
  text-transform: uppercase;
  font-size: 1rem;
  margin: 0;
  letter-spacing: .04em;
}
.board-meta { margin: .2rem 0 0; color: rgba(244,236,223,.7); font-size: .75rem; }
.usage-chip {
  margin: .55rem .85rem 0;
  background: rgba(194, 85, 43, .15);
  border: 1px solid rgba(232, 135, 92, .4);
  padding: .45rem .55rem;
  font-size: .78rem;
}
.bot-list {
  list-style: none;
  margin: 0;
  padding: .35rem 0 .6rem;
  overflow: auto;
}
.bot-list li {
  display: grid;
  grid-template-columns: .7rem 1fr auto;
  gap: .45rem .55rem;
  align-items: start;
  padding: .45rem .85rem;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.bot-list li:hover, .bot-list li.active { background: rgba(244, 236, 223, .06); }
.bot-list li.stale { border-left-color: var(--stale); background: rgba(194, 85, 43, .12); }
.dot {
  width: .7rem; height: .7rem; border-radius: 50%;
  margin-top: .25rem;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
.bot-name { font-weight: 700; font-size: .84rem; line-height: 1.2; }
.bot-name small { display: block; font-weight: 500; color: rgba(244,236,223,.55); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.bot-note { grid-column: 2 / 4; color: rgba(244,236,223,.8); font-size: .75rem; margin: 0; }
.bot-status {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(244,236,223,.75);
  white-space: nowrap;
}
.bot-list li.stale .bot-status { color: var(--stale); }

.dock {
  position: absolute;
  left: .75rem;
  right: calc(min(20rem, 34vw) + 1.5rem);
  bottom: .75rem;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.hint { margin: 0; font-size: .8rem; color: rgba(244,236,223,.7); flex: 1; }
#btn-simulate { width: auto; padding: .7rem 1.1rem; white-space: nowrap; }

.hover-card {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--cream);
  color: var(--ink);
  border-top: 4px solid var(--rust);
  padding: .55rem .7rem;
  min-width: 10rem;
  max-width: 18rem;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
  font-size: .82rem;
}
.hover-card strong { display: block; font-family: var(--slab); font-size: .95rem; }
.hover-card .hc-status { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; margin: .15rem 0; }
.hover-card p { margin: .2rem 0 0; color: var(--muted); }

@media (max-width: 800px) {
  .board {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 38%;
    border-top-width: 5px;
  }
  .dock {
    right: .75rem;
    bottom: calc(38% + .4rem);
  }
  .feed-warning { display: none; }
  .hint { display: none; }
}
