:root {
  color-scheme: light;
  font-family: system-ui, "Segoe UI", sans-serif;
  color: #132a37;
  background: #f3f7f8;
  --blue: #0074a8;
  --border: #ccd8df;
  --muted: #46616f;
}

* { box-sizing: border-box; }
body { margin: 0; }
.shell { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.portal-header { background: #fff; border-bottom: 1px solid var(--border); }
.header-content { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.75rem; }
.header-content img { display: block; width: clamp(8rem, 38vw, 13rem); height: auto; }
main { padding-block: clamp(1.75rem, 5vw, 3.75rem); }
h1 { margin: 0 0 1.5rem; font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.15; }
h2 { margin: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
p { line-height: 1.5; }
a { color: #00668f; }
form { margin: 0; }

.card { background: #fff; border: 1px solid var(--border); border-radius: .75rem; padding: 1.25rem; box-shadow: 0 2px 5px #132a370a; }
.message-card { max-width: 33rem; }
.message-card p { color: var(--muted); margin: .55rem 0 0; }
.device-grid, .sign-in-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.device-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.device-card { display: flex; flex-direction: column; }
.device-status { display: flex; gap: .45rem; align-items: center; color: var(--muted); margin: .45rem 0 1.25rem; }
.device-status::before { content: ""; border-radius: 50%; background: #8296a0; width: .5rem; height: .5rem; flex: none; }
.device-status.online::before { background: #228153; }
.device-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-top: auto; }
.sign-in-options { margin-top: 1.25rem; gap: .65rem; }
.sign-in-options .button { width: 100%; gap: .65rem; }
.sign-in-options .button img { flex: none; }
.portal-sign-in .header-content { justify-content: center; }
.portal-sign-in main { text-align: center; }
.portal-sign-in .message-card { margin-inline: auto; text-align: start; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: .55rem .85rem;
  border: 1px solid transparent;
  border-radius: .35rem;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: #005e8b; }
.secondary { border-color: #a9bdc8; background: #fff; color: #07597e; }
button.secondary:hover, .button.secondary:hover { background: #eaf4f8; }
button:disabled { border-color: #d5e0e5; background: #edf2f4; color: #46616f; cursor: default; }
:focus-visible { outline: 3px solid #0074a8; outline-offset: 3px; }
video { display: block; max-width: 100%; height: auto; margin-top: 1rem; background: #132a37; }

.screen-viewer {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  height: 100dvh;
  padding: .75rem 1rem;
  background: #f5f7f9;
}
.screen-header, .screen-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .65rem;
}
.screen-header { padding-bottom: .65rem; border-bottom: 1px solid var(--border); }
.screen-header h1 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.screen-header p { margin: 0; color: var(--muted); font-size: .9rem; }
.screen-actions { margin-left: auto; }
.screen-actions label { white-space: nowrap; }
.screen-actions button[hidden] { display: none; }
.screen-viewer button, .screen-viewer .button { min-height: 2rem; padding: .3rem .65rem; }
.screen-stage { flex: 1; min-height: 0; overflow: auto; border-radius: .4rem; background: #0b1016; }
.screen-stage video { width: 100%; height: 100%; max-width: none; margin: 0; object-fit: contain; background: transparent; }
.screen-stage.actual-size video { width: auto; height: auto; }

#rdp-setup-dialog,
.rdp-device-dialog {
  width: min(100% - 2rem, 36rem);
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: .85rem;
  background: #fff;
  color: inherit;
  box-shadow: 0 18px 55px #132a373d;
  overflow: auto;
}

#rdp-setup-dialog::backdrop,
.rdp-device-dialog::backdrop {
  background: #132a3766;
}

.rdp-setup-content {
  padding: clamp(1.15rem, 4vw, 1.65rem);
}

.rdp-setup-content h2 {
  font-size: 1.3rem;
  line-height: 1.3;
}

.rdp-setup-content p {
  margin: .6rem 0 1rem;
  color: var(--muted);
}

.rdp-setup-content ol {
  display: grid;
  gap: .65rem;
  margin: 0;
  padding: .9rem 1rem .9rem 2.25rem;
  border: 1px solid #dee8ed;
  border-radius: .5rem;
  background: #f4f8fa;
  line-height: 1.45;
}

.rdp-setup-content li {
  padding-left: .15rem;
  overflow-wrap: anywhere;
}

.rdp-setup-content li::marker {
  color: #07597e;
  font-weight: 600;
}

.rdp-setup-content code {
  padding: .1em .25em;
  border-radius: .25rem;
  background: #e7eff3;
}

.rdp-setup-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .55rem;
  padding: .85rem clamp(1.15rem, 4vw, 1.65rem);
  border-top: 1px solid #dee8ed;
  background: #f8fafb;
}

.rdp-split {
  display: inline-flex;
  position: relative;
}

.rdp-split > button:first-child {
  border-radius: .4rem 0 0 .4rem;
}

.rdp-split > .rdp-options-toggle {
  display: grid;
  place-items: center;
  min-width: 2.4rem;
  padding-inline: .6rem;
  border-left: 1px solid #ffffff70;
  border-radius: 0 .4rem .4rem 0;
}

.rdp-options-toggle::after {
  content: '';
  width: .48rem;
  height: .48rem;
  margin-top: -.22rem;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.rdp-options-panel {
  inset: auto;
  position-area: block-end span-inline-start;
  position-try-fallbacks: flip-block, flip-inline;
  margin: .35rem 0 0;
  min-width: min(15rem, 74vw);
  padding: .9rem;
  border: 1px solid #d8e5ec;
  border-radius: .5rem;
  background: white;
  box-shadow: 0 .4rem 1.2rem #17374426;
}

.rdp-options-panel:popover-open {
  display: grid;
  gap: .65rem;
}

.rdp-options-panel label {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.rdp-device-help {
  flex-basis: 100%;
  order: 1;
}

.rdp-device-help > p:not(:empty) { margin: .25rem 0; }
.rdp-device-help > p:empty { display: none; }
.portal-header-actions { display: flex; align-items: center; gap: .5rem; }
.portal-header-actions .button { white-space: nowrap; }
.portal-sign-in .header-content { position: relative; }
.portal-sign-in .portal-header-actions { position: absolute; inset-inline-end: 1rem; }
.portal-help { display: grid; gap: 1rem; max-width: 48rem; }
.portal-help summary { cursor: pointer; font-weight: 700; }
.portal-help img { display: block; max-width: 100%; width: 29rem; height: auto; border: 1px solid var(--border); border-radius: .5rem; }

.rdp-device-help[hidden], .rdp-device-help button[hidden], #rdp-setup[hidden] { display: none; }
