:root {
  --bg: #0f1420;
  --panel: #161d2c;
  --panel-2: #1c2536;
  --line: #2a3448;
  --ink: #eef2f8;
  --muted: #8d99ae;
  --gold: #ffc94d;
  --good: #2fbf71;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 700px at 50% 30%, #1b2540 0%, var(--bg) 70%);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

h1, h2, p { margin: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 32, 0.8);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.logo {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #ffd66b, #ff9f43);
  box-shadow: 0 6px 18px -6px #ff9f43;
}
.logo svg { width: 22px; height: 22px; fill: #3b2200; }
.brand h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand p { font-size: 12px; color: var(--muted); }

.stats { display: flex; gap: 12px; flex: 1; justify-content: center; }
.stat {
  display: flex; flex-direction: column;
  min-width: 140px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .v { font-size: 20px; font-weight: 800; }
.stat .v.bump { animation: bump 0.5s ease; }
@keyframes bump { 40% { transform: scale(1.15); color: var(--gold); } }

.clock { display: flex; align-items: center; gap: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 99px;
  background: rgba(47, 191, 113, 0.15); color: var(--good); font-size: 12px;
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 250px 1fr 310px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.panel h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}

/* Teams */
#team-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.team {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 12px; background: var(--panel-2);
  border: 1px solid transparent; transition: border-color 0.3s;
}
.team.busy { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.team { cursor: pointer; }
.team:hover { background: #222c40; }
.team.selected { background: color-mix(in srgb, var(--c) 18%, var(--panel-2)); border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset, 0 0 24px -6px var(--c); }
.team .badge {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); font-size: 17px;
}
.team .name { font-weight: 700; font-size: 14px; }
.team .job { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.team .meta { text-align: right; font-size: 11px; color: var(--muted); }
.team .meta b { display: block; font-size: 16px; color: var(--ink); }

/* Map */
.map-wrap {
  position: relative; border-radius: 16px; overflow: hidden;
  background: radial-gradient(900px 500px at 50% 45%, #253457 0%, #121a2b 75%);
  border: 1px solid var(--line);
}
#map { width: 100%; height: 100%; display: block; shape-rendering: geometricPrecision; }
#map .agent, #map .bubble { will-change: transform; }
.demo-pill {
  position: absolute; left: 14px; bottom: 14px;
  padding: 4px 10px; border-radius: 99px; font-size: 11px;
  background: rgba(255, 255, 255, 0.08); color: var(--muted);
}

.house { cursor: pointer; }
.house:hover .hl { opacity: 1; }
.hl { opacity: 0; transition: opacity 0.2s; }

.bubble { transition: opacity 0.25s; }

.house-card {
  position: absolute; right: 14px; top: 14px; width: 270px;
  background: rgba(22, 29, 44, 0.96); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; box-shadow: 0 18px 40px -14px rgba(0,0,0,0.6);
}
.house-card h3 { margin: 0; font-size: 17px; }
.house-card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.house-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0; font-size: 13px; }
.house-card dt { color: var(--muted); }
.house-card dd { margin: 0; font-weight: 600; text-align: right; }
.house-card ul { margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.house-card li { padding: 6px 0; border-top: 1px solid var(--line); }
.house-card .x { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.tag.ok { background: rgba(47,191,113,0.15); color: var(--good); }
.tag.due { background: rgba(255,201,77,0.15); color: var(--gold); }
.tag.vacant { background: rgba(166,107,255,0.18); color: #c9a6ff; }

/* Right panel */
.right { gap: 14px; }
.approvals { flex: none; }
#approval-list { display: flex; flex-direction: column; gap: 8px; }
.count { background: var(--gold); color: #3b2200; border-radius: 99px; padding: 1px 8px; font-size: 11px; }
.empty { color: var(--muted); font-size: 13px; }
.ap {
  padding: 10px 12px; border-radius: 12px; background: var(--panel-2);
  border-left: 3px solid var(--c); animation: slide 0.35s ease;
}
.ap .t { font-size: 13px; font-weight: 700; }
.ap .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ap .row { display: flex; gap: 8px; margin-top: 8px; }
.ap button {
  flex: 1; border: 0; border-radius: 8px; padding: 7px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.ap .yes { background: var(--good); color: #062614; }
.ap .no { background: rgba(255,255,255,0.08); color: var(--ink); }

.feed { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#feed { list-style: none; margin: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
#feed li {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: start;
  font-size: 12.5px; line-height: 1.35; padding: 7px 8px; border-radius: 10px; background: var(--panel-2);
  animation: slide 0.35s ease;
}
#feed li .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--c); }
#feed li time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
#feed li b { color: var(--c); }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 190px 1fr; grid-template-rows: 1fr auto; }
  .right { grid-column: 1 / -1; flex-direction: row; max-height: 34vh; }
  .right > div { flex: 1; min-width: 0; }
  .stats { display: none; }
  .brand { min-width: 0; }
  .team { grid-template-columns: 28px 1fr; padding: 8px; }
  .team .badge { width: 28px; height: 28px; font-size: 14px; }
  .team .job, .team .meta { display: none; }
  .team-card { width: 250px; }
}
@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; }
  .teams { max-height: none; }
  .map-wrap { min-height: 60vh; }
  .right { flex-direction: column; max-height: none; }
}

/* Team focus card */
.team-card {
  position: absolute; left: 14px; top: 14px; width: 300px; max-height: calc(100% - 28px); overflow-y: auto;
  background: rgba(18, 24, 37, 0.95); border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 14px;
  padding: 14px 14px 12px; box-shadow: 0 20px 44px -16px rgba(0,0,0,0.7); animation: slide 0.3s ease;
}
.team-card .x { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.tc-head { display: flex; gap: 10px; align-items: center; padding-right: 20px; }
.tc-head .badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--c) 22%, transparent); }
.tc-head h3 { margin: 0; font-size: 17px; }
.tc-head p { font-size: 12px; color: var(--muted); }
.team-card h4 { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.tc-agent { display: grid; grid-template-columns: 10px auto 1fr; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 10px; background: var(--panel-2); margin-bottom: 5px; font-size: 13px; }
.tc-agent span:last-child { color: var(--muted); text-align: right; font-size: 12px; }
.tc-agent .pip { width: 8px; height: 8px; border-radius: 50%; background: #5d6675; }
.tc-agent.walking .pip, .tc-agent.working .pip { background: var(--c); box-shadow: 0 0 8px var(--c); animation: pulse 1s infinite; }
.tc-agent.working span:last-child { color: var(--ink); }
.tc-todo, .tc-done { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.tc-todo li { padding: 7px 9px 7px 26px; border-radius: 10px; background: var(--panel-2); margin-bottom: 5px; position: relative; }
.tc-todo li::before { content: ""; position: absolute; left: 9px; top: 11px; width: 9px; height: 9px; border-radius: 3px; border: 2px solid var(--c); }
.tc-todo li.now::before { background: var(--c); }
.tc-todo li.yes { border: 1px solid var(--gold); }
.tc-todo li.clear { padding-left: 9px; color: var(--good); }
.tc-todo li.clear::before { display: none; }
.tc-done li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); color: var(--muted); }
.tc-done time { flex: none; font-size: 11px; }
.tc-actions { display: flex; gap: 8px; margin-top: 12px; }
.tc-actions button { flex: 1; border: 0; border-radius: 10px; padding: 9px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.tc-actions .go { background: var(--c); color: #0f1420; }
.tc-actions .back { background: rgba(255,255,255,0.08); color: var(--ink); }

/* Inside the website (iframe) */
body.embed .topbar { padding: 10px 16px; gap: 14px; }
body.embed .logo { width: 34px; height: 34px; }
body.embed .brand h1 { font-size: 17px; }
body.embed .stat { min-width: 120px; padding: 6px 12px; }
body.embed .stat .v { font-size: 17px; }
body.embed .layout { padding: 10px; gap: 10px; }
@media (max-width: 760px) {
  body.embed .right, body.embed .clock, body.embed .brand p { display: none; }
  body.embed .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  body.embed .teams { padding: 8px; }
  body.embed .teams h2 { display: none; }
  body.embed #team-list { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  body.embed .team { flex: none; grid-template-columns: 26px auto; padding: 7px 10px; }
  body.embed .team .name { font-size: 12.5px; white-space: nowrap; }
  body.embed .team-card { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 52%; }
  body.embed .house-card { left: 8px; right: 8px; width: auto; }
}
@media (min-width: 900px) and (max-width: 1100px) {
  body.embed .layout { grid-template-columns: 190px 1fr 250px; grid-template-rows: none; }
  body.embed .right { grid-column: auto; flex-direction: column; max-height: none; }
  body.embed .right > div { flex: none; }
  body.embed .right .feed { flex: 1; }
  body.embed .team-card { width: 260px; }
}
