:root {
  --brand-blue: #1f4fd1;
  --brand-blue-2: #2f6ff4;
  --brand-navy: #0b1b2b;
  --brand-muted: #5d6e83;
  --brand-surface: #f6f9ff;
  --brand-surface-alt: #eef4ff;
  --brand-card: #ffffff;
  --brand-line: #d7e3f2;
  --danger: #b42318;
  --success: #147a43;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--brand-navy);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #dbe7ff 0%, var(--brand-surface) 45%) no-repeat,
    linear-gradient(180deg, #ffffff, var(--brand-surface-alt));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(140deg, rgba(31, 79, 209, 0.08), transparent 45%),
    linear-gradient(320deg, rgba(47, 111, 244, 0.12), transparent 50%);
  opacity: 0.9;
  pointer-events: none;
  z-index: -1;
}

.nav-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--brand-muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0;
  text-decoration: none;
  text-transform: uppercase;
}

.nav-status span {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--danger);
}

.nav-status.online span {
  background: var(--success);
}

.nav-status:hover {
  color: var(--brand-blue);
}

a {
  color: inherit;
}

.container {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
}

.logo {
  color: var(--brand-navy);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--brand-blue);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.12;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
}

h2 {
  margin: 0 0 0.5rem;
}

h3 {
  margin: 0 0 0.5rem;
}

.subtitle,
.form-intro,
.muted,
.section-head p,
.card p {
  color: var(--brand-muted);
  line-height: 1.6;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.6fr);
  gap: 28px;
  width: min(1120px, 100%);
  align-items: stretch;
}

.landing-shell {
  grid-template-columns: minmax(0, 1.05fr) 420px;
  width: min(1040px, 100%);
}

.brand-panel,
.card {
  border: 1px solid var(--brand-line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 24px 70px rgba(15, 32, 61, 0.1);
  backdrop-filter: blur(18px);
}

.brand-panel {
  display: grid;
  align-content: space-between;
  min-height: 560px;
  padding: 34px;
  overflow: hidden;
  position: relative;
}

.brand-panel::after {
  content: "";
  position: absolute;
  right: -140px;
  bottom: -140px;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(31, 79, 209, 0.18), transparent 68%);
}

.brand-panel::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(31, 79, 209, 0.09);
  border-radius: 22px;
  pointer-events: none;
}

.topbar,
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.nav-link,
.navlinks a {
  color: var(--brand-muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.navlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.nav-link:hover,
.navlinks a:hover {
  color: var(--brand-blue);
}

.hero-copy {
  max-width: 640px;
  position: relative;
  z-index: 1;
}

.hero-copy h1 {
  margin: 0 0 1rem;
  max-width: 720px;
}

.access-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.access-points span {
  border: 1px solid rgba(31, 79, 209, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 9px 13px;
  text-transform: uppercase;
}

.auth-card {
  align-self: center;
  padding: 34px;
}

.auth-card h2 {
  font-size: 1.9rem;
}

.auth-card .form-intro {
  margin-bottom: 24px;
}

.stack-form,
.config-form,
.form-section,
.advanced-grid {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--brand-muted);
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--brand-line);
  border-radius: 14px;
  background: #fdfdff;
  color: var(--brand-navy);
  font: inherit;
  padding: 12px 14px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(31, 79, 209, 0.12);
  outline: none;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button,
.button.primary {
  background: var(--brand-blue);
  color: #fff;
}

button:hover,
.button.primary:hover {
  background: var(--brand-blue-2);
}

.button.secondary {
  border: 1px solid var(--brand-line);
  background: #fff;
  color: var(--brand-blue);
}

.button.danger {
  background: #fff;
  border: 1px solid rgba(180, 35, 24, 0.28);
  color: var(--danger);
}

.button.danger:hover {
  background: rgba(180, 35, 24, 0.08);
}

.button.small {
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
}

.alert,
.notice {
  border-radius: 16px;
  margin: 16px 0;
  padding: 14px 16px;
  font-weight: 600;
}

.alert {
  border: 1px solid #f0b8b4;
  background: #fff2f1;
  color: var(--danger);
}

.notice {
  border: 1px solid #b8e3c9;
  background: #f0fff5;
  color: var(--success);
}

.app-header {
  padding: 28px 0 8px;
}

.page {
  padding: 44px 0 72px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  border: 1px solid var(--brand-line);
  border-radius: 28px;
  background: linear-gradient(140deg, rgba(31, 79, 209, 0.12), rgba(255, 255, 255, 0.9));
  padding: 34px;
  box-shadow: 0 24px 70px rgba(15, 32, 61, 0.1);
}

.hero-actions,
.card-actions,
.form-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.section-head {
  margin: 36px 0 20px;
}

.section-head.compact {
  max-width: 820px;
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.session-card,
.empty-card,
.config-card,
.sessions-list {
  padding: 24px;
}

.session-topline,
.list-head,
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.protocol {
  border-radius: 999px;
  background: rgba(31, 79, 209, 0.1);
  color: var(--brand-blue);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand-line);
}

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

.session-health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.session-health span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #b7791f;
  box-shadow: 0 0 0 4px rgba(183, 121, 31, 0.12);
}

.session-health.online span {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(20, 122, 67, 0.12);
}

.session-health.offline span {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.12);
}

.session-health.warning span,
.session-health.unknown span {
  background: #b7791f;
  box-shadow: 0 0 0 4px rgba(183, 121, 31, 0.12);
}

.session-health.online {
  color: var(--success);
}

.session-health.offline {
  color: var(--danger);
}

.session-health.warning,
.session-health.unknown {
  color: #b7791f;
}

.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.advanced {
  border: 1px solid var(--brand-line);
  border-radius: 20px;
  background: var(--brand-surface);
  padding: 0;
  overflow: hidden;
}

.advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  cursor: pointer;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary span {
  color: var(--brand-navy);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
}

.advanced summary small {
  color: var(--brand-muted);
}

.advanced[open] {
  padding-bottom: 18px;
}

.advanced-grid {
  padding: 0 18px;
}

.advanced-group {
  border-top: 1px solid var(--brand-line);
  padding-top: 18px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.checkbox-line input {
  width: auto;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

body[data-protocol="ssh"] .rdp-fields,
body[data-protocol="ssh"] .web-fields,
body[data-protocol="rdp"] .ssh-fields,
body[data-protocol="rdp"] .web-fields,
body[data-protocol="web"] .ssh-fields,
body[data-protocol="web"] .rdp-fields {
  display: none;
}

body[data-protocol="web"] .credential-field.optional {
  opacity: 0.78;
}

.sessions-list {
  position: sticky;
  top: 18px;
}

.session-row {
  border-top: 1px solid var(--brand-line);
  padding: 14px 0;
}

.session-row span {
  display: block;
  color: var(--brand-muted);
  font-size: 14px;
  margin-top: 4px;
}

.row-actions a {
  color: var(--brand-blue);
  font-weight: 700;
  text-decoration: none;
}

.row-actions form,
.delete-session-form {
  margin: 0;
}

.delete-session-form {
  border-top: 1px solid var(--brand-line);
  margin-top: 18px;
  padding-top: 18px;
}

.link-button {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--brand-blue);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-decoration: none;
}

.link-button:hover {
  background: transparent;
}

.danger-link {
  color: var(--danger);
}

.client-page {
  overflow: hidden;
  background: #06111f;
}

.client-page::before {
  display: none;
}

.client-shell {
  position: fixed;
  inset: 0;
  display: block;
  height: 100vh;
  width: 100vw;
}

.client-dock {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.dock-tab,
.dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(215, 227, 242, 0.82);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 40px rgba(15, 32, 61, 0.16);
  color: var(--brand-navy);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  backdrop-filter: blur(16px);
  cursor: pointer;
  pointer-events: auto;
}

.dock-tab:hover,
.dock-icon:hover {
  color: var(--brand-blue);
  transform: translateY(-1px);
}

.dock-tab {
  cursor: grab;
  touch-action: none;
}

.dock-tab:active {
  cursor: grabbing;
}

.dock-icons {
  display: none;
  gap: 8px;
  pointer-events: auto;
}

.client-dock.expanded .dock-icons {
  display: grid;
}

.dock-panel {
  display: none;
  pointer-events: auto;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 142px));
  border: 1px solid var(--brand-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 50px rgba(15, 32, 61, 0.14);
  padding: 12px 14px;
}

.client-dock.expanded .dock-panel {
  display: grid;
  gap: 8px;
}

.dock-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.client-target {
  color: var(--brand-muted);
  font-size: 14px;
}

.status-icon {
  color: var(--danger);
}

.status-icon.online {
  color: var(--success);
}

.backend-status-icon {
  color: #b7791f;
}

.backend-status-icon.online {
  color: var(--success);
}

.backend-status-icon.offline {
  color: var(--danger);
}

.danger-icon {
  color: var(--danger);
}

.compact-logo {
  font-size: 14px;
}

.diagnosis-text {
  color: var(--brand-muted);
  font-size: 12px;
  line-height: 1.35;
}

.nav-status.offline span {
  background: var(--danger);
}

.nav-status.warning span,
.nav-status.unknown span {
  background: #b7791f;
}

.client-frame {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.guac-viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #050b14;
}

.guac-display {
  position: absolute;
  inset: 0;
  outline: none;
  overflow: hidden;
}

.guac-display > div {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

.guac-status {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(6, 17, 31, 0.88);
  color: #fff;
  font-weight: 700;
  padding: 14px 18px;
  text-align: center;
}

.guac-status.hidden {
  display: none;
}

.guac-status.error {
  background: rgba(180, 35, 24, 0.92);
}

.guac-status-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.guac-status-actions button,
.guac-status-actions a {
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 8px 12px;
  text-decoration: none;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.metric-card {
  padding: 22px;
}

.metric-card span {
  color: var(--brand-muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 1.7rem;
}

.graph-card {
  padding: 24px;
}

#trafficGraph {
  width: 100%;
  border: 1px solid var(--brand-line);
  border-radius: 16px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .auth-shell,
  .config-layout,
  .hero-card {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: auto;
  }

  .sessions-list {
    position: static;
  }
}

@media (max-width: 640px) {
  .auth-page {
    padding: 16px;
  }

  .brand-panel,
  .auth-card,
  .hero-card,
  .session-card,
  .config-card,
  .sessions-list {
    border-radius: 18px;
    padding: 20px;
  }

  .form-grid,
  .access-points,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .client-shell {
    height: 100vh;
  }

  .client-dock {
    left: 10px;
    top: 10px;
  }

  .dock-panel {
    max-width: calc(100vw - 88px);
  }

  .nav-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
