:root {
  color-scheme: dark;
  --bg: #101722;
  --surface: #172033;
  --surface-2: #0b1220;
  --line: #29364d;
  --text: #edf2f7;
  --muted: #a8b3c7;
  --accent: #10b981;
  --accent-dark: #059669;
  --danger: #ef4444;
  --warning: #f59e0b;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.rdp-shell {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  max-height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 22px;
}

.sidebar-title,
.section-head,
.desktop-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 17px;
}

.panel-section {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.badge {
  min-width: 88px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.badge.connected {
  border-color: rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.12);
  color: #7ee1b6;
}

.badge.connecting {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.12);
  color: #f9ca72;
}

.badge.failed {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  padding: 10px 11px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

.inline-grid,
.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #04130d;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

button:hover {
  background: var(--accent-dark);
  color: white;
}

button:disabled {
  cursor: default;
  opacity: 0.52;
}

#logoutButton,
#clearButton,
.toolbar-button,
.auth-actions button {
  background: #334155;
  color: var(--text);
}

.resolve-box {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 18, 32, 0.72);
  color: var(--muted);
  padding: 12px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.gateway-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.gateway-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 18, 32, 0.72);
  padding: 9px;
}

.gateway-item span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.gateway-item button {
  min-height: 30px;
  background: #334155;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.nav-links a,
.auth-actions a {
  color: var(--muted);
  font-size: 14px;
}

.desktop-area {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 100vh;
  background: #050914;
}

.desktop-toolbar {
  justify-content: flex-end;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.94);
  padding: 8px 12px;
}

.toolbar-button {
  min-width: 86px;
  min-height: 34px;
}

.desktop-area:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  background: #050914;
}

.desktop-area:fullscreen .display-wrap {
  padding: 8px;
}

.display-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  outline: none;
  display: grid;
  place-items: center;
  padding: 12px;
}

.display-wrap:focus,
.display-wrap.input-active {
  box-shadow: inset 0 0 0 2px rgba(16, 185, 129, 0.45);
}

.display {
  transform-origin: center center;
  cursor: default;
  user-select: none;
}

.display > div {
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.32);
  pointer-events: auto;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

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

.empty-state strong {
  color: var(--text);
  font-size: 22px;
}

.message-log {
  min-height: 104px;
  max-height: 180px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.92);
  color: var(--muted);
  padding: 12px 16px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.24);
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.auth-actions button {
  min-width: 90px;
}

.auth-message {
  min-height: 22px;
  margin-top: 14px;
  color: #fca5a5;
  font-size: 13px;
}

@media (max-width: 980px) {
  .rdp-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .desktop-area {
    min-height: 620px;
  }
}
