/* VDI client (vdi.html). Colors, sizes and layout follow the native skypc-app launcher
   (src/screens/{mod,auth,desktops,dashboard_ui}.rs, src/floe_ui). */

@font-face {
  font-family: "Inter";
  font-weight: 400;
  font-display: swap;
  src: url("./assets/Inter-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-weight: 500;
  font-display: swap;
  src: url("./assets/Inter-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-weight: 700;
  font-display: swap;
  src: url("./assets/Inter-Bold.ttf") format("truetype");
}

/* Palette::of(false) */
:root {
  color-scheme: light;
  --card: #ffffff;
  --border: #e3e8f0;
  --text: #0f1729;
  --muted: #667385;
  --field: #f6f8fa;
  --outer: #f5f7f9;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-pressed: #1740b3;
  --accent-text: #ffffff;
  --tabs: #f0f2f5;
  --hover: #f5f7fa;
  --selected: #ebedf5;
  --input-border: #e0e0e6;
  --input-hover: #b3b3bf;
  --input-focus: #17171c;
  --online: #2ebf61;
  --windows-blue: #0078d6;
  --error: #d93333;
  --login-bg: #ffffff;
}

/* Palette::of(true) */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --card: #17171c;
    --border: #292930;
    --text: #f2f2f5;
    --muted: #80808c;
    --field: #1c1c21;
    --outer: #0d0d0f;
    --accent: #619efa;
    --accent-hover: #73adff;
    --accent-pressed: #4d8ce6;
    --accent-text: #17171c;
    --tabs: #1c1c21;
    --hover: rgb(255 255 255 / 0.04);
    --selected: rgb(255 255 255 / 0.08);
    --input-border: #33333d;
    --input-hover: #595966;
    --input-focus: #fafafa;
    --login-bg: #0d0d0f;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--outer);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12.5px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons: floe_ui accent_button_style / secondary_button_style. */
.accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.accent:hover:not(:disabled) {
  background: var(--accent-hover);
}

.accent:active:not(:disabled) {
  background: var(--accent-pressed);
}

.accent:disabled {
  opacity: 0.55;
}

.secondary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

.secondary:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.secondary .icon {
  width: 13px;
  height: 13px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover:not(:disabled) {
  background: var(--hover);
  border-color: var(--border);
}

.icon-button.small {
  padding: 3px 5px;
}

.icon-button.small .icon {
  width: 13px;
  height: 13px;
}

/* language_switch */
.lang-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--tabs);
}

.lang-switch button {
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}

.lang-switch button[aria-pressed="true"] {
  border-color: var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 700;
}

/* Inputs: floe_ui input_style / pick_list_style */
.input,
.password-box,
select {
  min-width: 0;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
}

.input,
select {
  padding: 8px 10px;
}

select {
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11.5px;
}

.input:hover,
select:hover:not(:disabled),
.password-box:hover {
  border-color: var(--input-hover);
}

.input:focus,
select:focus,
.password-box:focus-within {
  border-color: var(--input-focus);
  outline: none;
}

.input::placeholder,
.password-box input::placeholder {
  color: var(--muted);
}

select:disabled {
  color: var(--muted);
  background: var(--field);
}

/* ---- Sign-in (auth.rs) ---- */
.login {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 16px;
  background: var(--login-bg);
}

body.signed-in .login {
  display: none;
}

.login-card {
  display: grid;
  gap: 8px;
  width: min(360px, 100%);
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

.login-top {
  display: flex;
  justify-content: flex-end;
}

.login-logo {
  justify-self: center;
  width: 28px;
  height: 28px;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

.login-desc {
  margin: 0 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.login-error {
  margin: 0;
  padding: 6px 10px;
  color: var(--error);
  font-size: 11.5px;
}

.login-error:empty {
  display: none;
}

.field {
  display: grid;
  gap: 3px;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 500;
}

.field > span:first-child {
  margin-bottom: 0;
}

.field .input {
  font-weight: 400;
}

.password-box {
  display: flex;
  align-items: center;
}

.password-box input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  font-weight: 400;
  outline: none;
}

.eye {
  display: inline-flex;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.eye .icon {
  width: 13px;
  height: 13px;
}

.eye .eye-closed,
.eye[aria-pressed="true"] .eye-open {
  display: none;
}

.eye[aria-pressed="true"] .eye-closed {
  display: block;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 3px 0;
  cursor: pointer;
}

.check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.wide {
  width: 100%;
  padding: 9px 14px;
}

/* ---- Dashboard (desktops.rs) ---- */
.dashboard {
  display: none;
  height: 100%;
}

body.signed-in .dashboard {
  display: flex;
}

body.connected .dashboard {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: none;
  width: 215px;
  padding: 14px 10px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--card);
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-title .icon {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.desktop-list {
  display: grid;
  gap: 3px;
}

.desktop-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 6px 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
}

.desktop-item:hover {
  background: var(--hover);
}

.desktop-item[aria-selected="true"] {
  background: var(--selected);
}

.desktop-item[aria-selected="true"]::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 1.5px;
  background: var(--accent);
}

.desktop-item .tile {
  width: 14px;
  height: 14px;
  flex: none;
  fill: var(--muted);
}

.desktop-item.connectable .tile {
  fill: var(--windows-blue);
}

.desktop-item .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}

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

.sidebar-note {
  margin: 0;
  padding: 7px;
  color: var(--muted);
  font-size: 11px;
}

.sidebar-note:empty {
  display: none;
}

.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--card);
}

.brand-icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.brand {
  margin-left: 1px;
  font-size: 15px;
  font-weight: 700;
}

.spacer {
  flex: 1;
}

.account {
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 16px 20px 24px;
  overflow-y: auto;
}

.notice {
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  color: var(--error);
  font-size: 11.5px;
}

.notice:empty {
  display: none;
}

.placeholder {
  margin: 0;
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

.placeholder:empty {
  display: none;
}

.detail {
  display: grid;
  gap: 12px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ok {
  color: var(--online);
}

.status-pill.ok .dot {
  background: var(--online);
}

.detail-header h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 700;
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.banner-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}

.banner {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  height: 190px;
  padding: 16px;
  border-radius: 4px;
  background: url("./assets/background.jpg") center / cover no-repeat;
}

.connect {
  padding: 9px 20px;
  font-size: 13px;
}

.connect .icon {
  width: 15px;
  height: 15px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.fact {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
}

.fact span {
  color: var(--muted);
  font-size: 10.5px;
}

.fact b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
}

.devices {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  font-size: 13px;
  font-weight: 700;
}

.device-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12.5px;
  font-weight: 500;
}

.device-row .icon {
  color: var(--muted);
}

.device-row.active .icon {
  color: var(--accent);
}

.device-row > span {
  flex: 1;
}

.device-row select,
.picker-button {
  width: 200px;
  flex: none;
}

.picker-button {
  justify-content: center;
}

.media-note {
  margin: 4px 0 0;
  color: #c27803;
  font-size: 11.5px;
  line-height: 1.4;
}

.media-note:empty {
  display: none;
}

.advanced {
  padding: 10px 14px;
}

.advanced summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.setting {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.setting select,
.setting .input {
  width: 100%;
  color: var(--text);
  font-size: 12px;
}

.custom-size {
  display: flex;
  align-items: end;
  gap: 6px;
}

.footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 24px;
  border-top: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
}

#footer-status {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Session stage (copied from styles.css) ---- */
.stage {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: #07090d;
  overflow: hidden;
}

body.connected .stage {
  display: grid;
  cursor: none;
}

#video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  object-fit: contain;
}

#cursor {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  pointer-events: none;
  z-index: 1;
}

.fullscreen-button {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid rgb(255 255 255 / 0.24);
  border-radius: 6px;
  background: rgb(0 0 0 / 0.62);
  color: #f5f7fb;
}

.status {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  max-width: min(34rem, calc(100% - 1.5rem));
  padding: 0.45rem 0.65rem;
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 6px;
  background: rgb(0 0 0 / 0.68);
  color: #eef1f6;
  font-size: 0.8125rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.status:empty {
  display: none;
}

/* Narrow windows: one column, like the native compact layout. */
@media (max-width: 720px) {
  /* One column scrolled as a page: title bar, desktop list, details, footer. */
  .dashboard {
    flex-direction: column;
    height: auto;
    min-height: 100%;
  }

  body.signed-in .dashboard {
    display: flex;
  }

  .content {
    display: contents;
  }

  .titlebar {
    order: -1;
    padding: 8px 12px;
  }

  .sidebar {
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  .panel {
    flex: 1 0 auto;
    overflow: visible;
  }

  .account {
    display: none;
  }

  .panel {
    padding: 14px 12px 24px;
  }

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

  .device-row select,
  .picker-button {
    width: 150px;
  }
}
