:root {
  --bg: #0f172a;
  --bg-deep: #07111f;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-soft: rgba(255, 255, 255, 0.08);
  --ink: #111827;
  --light-ink: #ffffff;
  --muted: #64748b;
  --muted-light: rgba(255, 255, 255, 0.68);
  --line: rgba(148, 163, 184, 0.28);
  --blue: #2563eb;
  --cyan: #06b6d4;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --screen: #08111f;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--light-ink);
  background:
    radial-gradient(circle at 16% 12%, rgba(37, 99, 235, 0.32), transparent 34%),
    radial-gradient(circle at 86% 10%, rgba(6, 182, 212, 0.2), transparent 32%),
    linear-gradient(145deg, var(--bg-deep), var(--bg));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  color: var(--light-ink);
  background: rgba(7, 17, 31, 0.86);
  box-shadow: var(--shadow), 0 0 90px rgba(6, 182, 212, 0.12);
  backdrop-filter: blur(18px);
}

.login-logo {
  width: 220px;
  margin: 0 auto 18px;
  filter: drop-shadow(0 16px 34px rgba(6, 182, 212, 0.2));
}

.login-kicker {
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 10px 0 10px;
  font-size: 34px;
  line-height: 1.05;
}

.login-card p {
  margin: 0;
  color: var(--muted-light);
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.login-form label {
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: var(--light-ink);
  background: rgba(255, 255, 255, 0.08);
}

.login-form button {
  margin-top: 8px;
}

.login-note {
  margin-top: 16px !important;
  font-size: 12px;
}

.dashboard {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.dashboard-nav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(7, 17, 31, 0.86);
  backdrop-filter: blur(18px);
}

.dashboard-brand img {
  width: 174px;
}

.dashboard-links {
  display: grid;
  gap: 8px;
}

.dashboard-links a,
.logout-button {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 800;
}

.dashboard-links a.active,
.dashboard-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.logout-button {
  margin-top: auto;
  width: 100%;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.dashboard-main {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 24px;
}

.dashboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-top h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.dashboard-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.dashboard-user span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  font-weight: 900;
}

.dashboard-user small {
  display: block;
  color: var(--muted-light);
}

.dashboard-cards,
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-cards article,
.info-card,
.workspace-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.dashboard-cards article {
  padding: 18px;
}

.dashboard-cards span {
  color: var(--muted-light);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-cards strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.workspace-card {
  overflow: hidden;
}

.workspace-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.workspace-heading h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.workspace-heading p {
  max-width: 520px;
  margin: 0;
  color: var(--muted-light);
  font-size: 14px;
}

.info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-card {
  padding: 20px;
}

.info-card h2 {
  margin: 6px 0 8px;
}

.info-card p {
  margin: 0;
  color: var(--muted-light);
}

.shell {
  display: grid;
  grid-template-columns: 372px 1fr;
  min-height: calc(100vh - 310px);
  position: relative;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  background: rgba(7, 17, 31, 0.76);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.brand p,
.viewer h2,
.status-card p {
  margin: 0;
}

.brand p {
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 700;
}

.brand-logo {
  width: 180px;
  height: auto;
  filter: drop-shadow(0 16px 34px rgba(6, 182, 212, 0.18));
}

.connect-form {
  display: grid;
  gap: 7px;
}

.connect-form label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

#codeInput {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: var(--light-ink);
  background: rgba(255, 255, 255, 0.08);
  font-size: 22px;
  letter-spacing: 3px;
}

#codeInput::placeholder {
  color: rgba(255, 255, 255, 0.42);
  font-size: 13px;
  letter-spacing: 0;
}

button {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.18);
}

button:hover {
  background: linear-gradient(135deg, var(--brand-dark), #0891b2);
}

button:disabled {
  cursor: not-allowed;
  background: rgba(148, 163, 184, 0.45);
  box-shadow: none;
}

.danger {
  width: 100%;
  background: var(--danger);
  box-shadow: 0 14px 28px rgba(239, 68, 68, 0.22);
}

.danger:hover {
  background: #dc2626;
}

.status-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: #98a2b3;
}

.dot.ok {
  background: var(--success);
}

.dot.warn {
  background: var(--warning);
}

.dot.bad {
  background: var(--danger);
}

.status-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 2px;
}

.tech-profile {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.tech-avatar {
  width: 42px;
  height: 42px;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
}

.tech-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tech-profile-fields {
  display: grid;
  gap: 4px;
}

.tech-profile-fields label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tech-profile-fields input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
}

.actions {
  display: grid;
  gap: 7px;
  margin-top: auto;
}

.file-tools {
  display: grid;
  gap: 7px;
  margin-bottom: 8px;
}

.chat-panel {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.panel-label {
  color: var(--ink);
  font-size: 14px;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 6px;
  height: 82px;
  overflow: auto;
  padding-right: 4px;
}

.chat-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: end;
}

.chat-row.me {
  grid-template-columns: minmax(0, 1fr) auto;
}

.chat-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  overflow: hidden;
  border-radius: 50%;
  background: #d9e5f2;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-message {
  max-width: 90%;
  padding: 6px 8px;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chat-message.me {
  justify-self: end;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.chat-row.me .chat-avatar {
  grid-column: 2;
  grid-row: 1;
}

.chat-row.me .chat-message {
  grid-column: 1;
  grid-row: 1;
}

.chat-meta {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.75;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-form input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
}

.chat-form button {
  height: 36px;
}

.drop-zone {
  display: grid;
  place-content: center;
  gap: 6px;
  min-height: 132px;
  padding: 14px;
  border: 2px dashed rgba(37, 99, 235, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.drop-zone strong {
  color: var(--ink);
  font-size: 15px;
}

.drop-zone span {
  font-size: 13px;
}

.drop-file-list {
  display: grid;
  gap: 6px;
  width: 100%;
  max-height: 86px;
  overflow: auto;
  margin-top: 8px;
  text-align: left;
}

.drop-file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.drop-file-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-file-item span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.drop-zone.active {
  border-color: var(--cyan);
  background: #eff6ff;
  color: var(--brand-dark);
}

.drop-zone.disabled {
  opacity: 0.55;
}

.secondary-action {
  width: 100%;
  color: var(--light-ink);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--panel-soft);
  box-shadow: none;
}

.secondary-action:hover {
  background: rgba(255, 255, 255, 0.14);
}

.secondary-action.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.request-control-action {
  width: 100%;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

#controlButton,
#controlStatus {
  display: none !important;
}

.control-status {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  text-align: center;
}

.viewer {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 28px;
}

.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.viewer-button:hover {
  background: #eef2f7;
}

.viewer-button.wide {
  width: auto;
  padding: 0 12px;
}

.zoom-label {
  min-width: 48px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.eyebrow {
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.viewer h2 {
  font-size: 24px;
  margin-top: 4px;
}

.badge {
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.screen-wrap {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background: var(--screen);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: grab;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.36), 0 0 80px rgba(6, 182, 212, 0.12);
}

.video-stage {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  will-change: transform;
}

video {
  width: 100%;
  height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--screen);
}

video.control-active {
  cursor: default;
}

.screen-wrap.panning {
  cursor: grabbing;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: #d0d5dd;
}

.empty-state span {
  color: #98a2b3;
  font-size: 14px;
}

.empty-state.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

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

  .dashboard-nav {
    position: static;
    height: auto;
  }

  .dashboard-top,
  .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-cards,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .viewer {
    padding: 20px;
  }
}
