:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #5b6673;
  --line: #d9dee5;
  --primary: #0b6bcb;
  --primary-dark: #084f96;
  --danger: #a92727;
  --ok-bg: #eef7f1;
  --ok-line: #b8ddc3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0.62rem 0.85rem;
  cursor: pointer;
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button:hover:not(:disabled) { border-color: var(--primary); }
button.primary:hover:not(:disabled) { background: var(--primary-dark); }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 32px auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(18, 27, 38, 0.08);
}

.auth-panel {
  width: min(480px, 100%);
  margin: 10vh auto 0;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 { margin-bottom: 4px; font-size: 1.6rem; }
h2 { margin-bottom: 6px; font-size: 1.35rem; }
p { color: var(--muted); }

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.75rem;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.workspace-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.workspace-brand-mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.security-note {
  margin: 18px 0;
  border: 1px solid var(--ok-line);
  border-radius: 6px;
  background: var(--ok-bg);
  padding: 10px 12px;
  color: #214b2c;
}

.capability-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.capability-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: #fbfcfd;
}

.session-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.session-facts div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  min-width: 0;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 4px;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.viewer {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  overflow: hidden;
}

.viewer-empty {
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: #d8dee7;
}

.rfb-target {
  width: 100%;
  height: 100%;
  min-height: 420px;
}

.pro-relay-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  background: #000;
  object-fit: contain;
  outline: none;
}

.error {
  color: var(--danger);
  font-weight: 650;
  margin-bottom: 0;
}

.status-line {
  min-height: 1.4em;
  margin-bottom: 0;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  width: min(520px, calc(100% - 32px));
}

dialog::backdrop {
  background: rgba(18, 27, 38, 0.45);
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 4px 0 0;
}

@media (max-width: 760px) {
  .workspace-header,
  .actions {
    display: grid;
    justify-content: stretch;
  }

  .session-facts {
    grid-template-columns: 1fr;
  }
}
