:root {
  --bg: #ffffff;
  --bg-2: #f7f8f9;
  --panel: #f4f5f6;
  --panel-2: #eceeef;
  --line: #d8dcde;
  --charcoal: #3d444c;
  --text: #121416;
  --muted: #5c646c;
  --orange: #ff5c00;
  --orange-hover: #e65300;
  --orange-dim: rgba(255, 92, 0, 0.12);
  --green: #ff5c00;
  --green-2: #ff5c00;
  --warn: #c48a12;
  --danger: #d4523a;
  --idle: #8d949b;
  --font-sans: Outfit, "Segoe UI", system-ui, sans-serif;
  --font-serif: Fraunces, "Iowan Old Style", Georgia, serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  overflow: hidden;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow {
  color: var(--orange);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--charcoal);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-lockup .wordmark {
  height: 28px;
  width: auto;
  display: block;
}

.muted {
  color: var(--muted);
}

.login-view {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background: var(--bg-2);
}

.login-card {
  width: min(420px, 100%);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  display: grid;
  gap: 12px;
}

.login-card .wordmark {
  height: 32px;
  width: auto;
  display: block;
}

.login-card h1 {
  font-size: 1.85rem;
}

.login-card input,
.login-card button,
.lookup-form input,
.lookup-form button,
#stop-btn,
#enhance-btn,
.ghost-btn,
.nav-btn,
.connect-btn,
.fab-btn,
.icon-btn,
.search-field input {
  font: inherit;
}

.login-card input,
.lookup-form input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
}

.login-card input:focus,
.lookup-form input:focus {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}

.login-card button,
.lookup-form button {
  background: var(--orange);
  color: white;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:hover,
.lookup-form button:hover {
  filter: brightness(1.05);
}

.login-register {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-register a {
  color: var(--orange);
}
.lookup-form button:hover {
  background: var(--orange-hover);
}

#stop-btn {
  background: var(--danger);
  color: white;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

#enhance-btn {
  width: 100%;
  margin: 12px 0 14px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
}

#enhance-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}

#record-btn {
  width: 100%;
  margin: 10px 0 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
}

#record-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#record-btn.recording {
  background: var(--warn);
  border-color: var(--warn);
  color: #0a100d;
}

.recording-ui {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.recording-download {
  color: var(--green-2);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
}

.assist-tools {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.assist-label {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.assist-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tool-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
}

.tool-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}

.tool-btn.danger.active {
  background: var(--danger);
  border-color: var(--danger);
}

#tool-clear {
  width: 100%;
}

.ghost-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: var(--charcoal);
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
}

.shell-view {
  height: 100%;
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: 84px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
}

.nav-btn {
  width: 64px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  padding: 10px 6px 8px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 650;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
}

.nav-btn:hover {
  background: var(--orange-dim);
  color: var(--text);
}

.nav-btn.active {
  background: var(--orange);
  color: white;
}

.nav-btn.active:hover {
  background: var(--orange-hover);
  color: white;
}

.sidebar-mark {
  width: 40px;
  height: auto;
  display: block;
  margin: 0 0 16px;
}

.shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--bg);
}

.topbar-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.agent-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-profile strong {
  display: block;
  font-size: 0.92rem;
}

.agent-role {
  font-size: 0.72rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.chip.ok {
  color: var(--green-2);
}

.dashboard-view,
.sessions-view,
.session-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg-2);
}

.dashboard-view {
  position: relative;
  padding: 24px 28px 88px;
}

.sessions-view {
  padding: 24px 28px;
}

.connect-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  min-height: 46px;
}

.search-field svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.search-field:focus-within {
  border-color: var(--orange);
}

.search-field input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  outline: none;
  padding: 12px 0;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--charcoal);
}

.device-count {
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.server-key-box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
}

.server-key-label {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.server-key-box code {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  word-break: break-all;
}

.device-list {
  display: grid;
  gap: 10px;
}

.device-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}

.device-actions {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.observe-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.observe-btn:disabled,
.connect-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.phone-frame.remote-focus {
  outline: 2px solid var(--green-2);
  outline-offset: 2px;
}

.remote-keyboard {
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  z-index: 8;
  pointer-events: none;
}

.device-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.device-icon.ios {
  color: var(--green-2);
}

.device-icon.android {
  color: var(--charcoal);
}

.device-icon.web,
.device-icon.flutter,
.device-icon.react-native {
  color: #3aa0ff;
}

.device-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-weight: 650;
}

.device-status {
  font-size: 0.82rem;
  font-weight: 650;
}

.device-status.online {
  color: var(--green-2);
}

.device-status.busy {
  color: var(--warn);
}

.device-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.device-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.device-empty {
  padding: 48px 12px;
  text-align: center;
}

.connect-btn {
  background: var(--orange);
  color: white;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.connect-btn:hover:not(:disabled) {
  background: var(--orange-hover);
}

.connect-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fab-btn {
  position: sticky;
  bottom: 16px;
  display: block;
  margin: 28px auto 0;
  background: var(--orange);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: none;
}

.fab-btn:hover {
  background: var(--orange-hover);
}

.sessions-panel {
  max-width: 760px;
}

.modal {
  position: absolute;
  inset: 0;
  background: rgba(18, 20, 22, 0.45);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.modal-card {
  width: min(440px, 100%);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.dashboard-copy {
  margin-bottom: 16px;
  line-height: 1.45;
}

.layout {
  display: grid;
  grid-template-columns: 240px minmax(280px, 1fr) 300px;
  gap: 16px;
  padding: 16px;
  height: 100%;
  align-items: stretch;
}

.session-view.is-web-session .layout {
  grid-template-columns: 200px minmax(480px, 1fr) 220px;
}

.player-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.browser-chrome {
  display: none;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  background: #1b222c;
  border: 1px solid #2a3340;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  color: #9aa8b8;
  font-size: 0.78rem;
}

.player-stage.is-web .browser-chrome {
  display: flex;
}

.browser-dots {
  flex-shrink: 0;
  width: 42px;
  height: 10px;
  background:
    radial-gradient(circle at 5px 50%, #ff5f57 4px, transparent 5px),
    radial-gradient(circle at 21px 50%, #febc2e 4px, transparent 5px),
    radial-gradient(circle at 37px 50%, #28c840 4px, transparent 5px);
}

.browser-url {
  flex: 1;
  min-width: 0;
  background: #0e141c;
  border-radius: 999px;
  padding: 5px 12px;
  color: #c5d0dc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.session-view .panel {
  min-height: 0;
  overflow: auto;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.bandwidth-meter {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

#session-elapsed {
  font-size: 0.92rem;
  font-weight: 650;
}

#stream-fps {
  font-size: 0.72rem;
  color: var(--muted);
}

#bandwidth-rate {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--green-2);
}

#bandwidth-total {
  font-size: 0.72rem;
  color: var(--muted);
}

.lookup-form {
  display: grid;
  gap: 10px;
}

.otp-box {
  margin-top: 18px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  display: grid;
  gap: 8px;
}

.otp-code {
  font-size: 2.4rem;
  letter-spacing: 0.28em;
  font-weight: 700;
  color: var(--green-2);
}

.session-customer {
  font-size: 1rem;
  font-weight: 650;
  margin-bottom: 8px;
}

.device-facts {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.device-facts div {
  display: grid;
  gap: 2px;
}

.device-facts dt {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.device-facts dd {
  margin: 0;
  font-size: 0.88rem;
}

.device-map-wrap {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.device-map-wrap iframe {
  width: 100%;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}

.phone-frame {
  position: relative;
  width: min(380px, 100%);
  margin: 0 auto;
  aspect-ratio: 9 / 19.5;
  background: #0a100d;
  border: 8px solid #111;
  border-radius: 28px;
  overflow: hidden;
}

.phone-frame.is-web {
  width: 100%;
  max-width: none;
  margin: 0;
  aspect-ratio: 16 / 10;
  min-height: 280px;
  border: 1px solid #2a3340;
  border-radius: 0 0 12px 12px;
  background: #0a0d12;
}

.phone-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  background: #000;
  pointer-events: none;
  user-select: none;
}

.draw-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  z-index: 4;
}

.phone-frame.tool-pointer,
.phone-frame.tool-draw,
.phone-frame.tool-remote {
  cursor: crosshair;
}

.phone-frame.tool-pointer .draw-canvas,
.phone-frame.tool-draw .draw-canvas,
.phone-frame.tool-remote .draw-canvas {
  pointer-events: auto;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  z-index: 2;
}

.blocked-screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
  background: #101816;
  color: #f3f4f5;
}

.blocked-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #3a2a12;
  color: var(--warn);
  font-size: 1.6rem;
  font-weight: 700;
}

.blocked-screen h3 {
  font-size: 1.05rem;
  font-weight: 650;
}

.blocked-screen p {
  color: #8d949b;
  font-size: 0.88rem;
  line-height: 1.4;
}

.pointer {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid #ffb27a;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255, 91, 0, 0.22);
  pointer-events: none;
  z-index: 5;
}

.agent-pointer {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid #ff5b00;
  border-radius: 50%;
  background: rgba(255, 91, 0, 0.28);
  pointer-events: none;
  z-index: 6;
}

.timeline,
.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.timeline li,
.audit-list li {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.time {
  color: var(--muted);
  font-size: 0.72rem;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
