:root {
  color-scheme: dark;
  --bg: #0a0d12;
  --panel: #11161f;
  --panel-2: #0d1219;
  --border: #252d39;
  --text: #edf2f7;
  --muted: #8d99aa;
  --accent: #65d1a4;
  --accent-strong: #43b98b;
  --danger: #ff6b6b;
  --warning: #f4c76b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.terminal-error {
  display: grid;
  gap: 8px;
  max-width: 620px;
  margin: 24px;
  padding: 16px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.08);
  color: #d8dee8;
  font-size: 13px;
  line-height: 1.5;
}

.terminal-error strong {
  color: var(--danger);
}

.terminal-error span {
  color: var(--muted);
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  height: 100vh;
  min-height: 0;
}

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

.app-shell {
  width: 100%;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 13, 18, 0.96);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

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

h1 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 8px;
  font-size: 17px;
}

.status-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.status-offline {
  background: #647082;
}

.status-connecting {
  background: var(--warning);
}

.status-online {
  background: var(--accent);
}

.status-error {
  background: var(--danger);
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
}

.connection-panel {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding: 22px;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.panel-heading p {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

label {
  display: block;
  margin: 13px 0 6px;
  color: #c8d0db;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #303948;
  border-radius: 8px;
  outline: none;
  background: #0a0f16;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input,
select {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  min-height: 120px;
  padding: 10px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(101, 209, 164, 0.1);
}

.field-row {
  display: grid;
  gap: 8px;
}

.host-row {
  grid-template-columns: minmax(0, 1fr) 78px;
}

.muted,
.field-help {
  color: var(--muted);
}

.field-help {
  margin: 7px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 20px;
}

button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 100ms ease, opacity 100ms ease, background 100ms ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  background: var(--accent);
  color: #07110d;
}

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

.secondary {
  border-color: #354052;
  background: #171e29;
  color: var(--text);
}

.security-note {
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 12px;
  border: 1px solid rgba(244, 199, 107, 0.25);
  border-radius: 8px;
  background: rgba(244, 199, 107, 0.06);
  color: #c5b58d;
  font-size: 11.5px;
  line-height: 1.45;
}

.security-note strong {
  color: var(--warning);
}

.terminal-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #05070a;
}

.terminal-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#session-label {
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#terminal {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 12px 10px;
  overflow: hidden;
}

.xterm {
  height: 100%;
}

.xterm-viewport {
  scrollbar-color: #364052 #0a0d12;
}

@media (max-width: 820px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }

  body {
    height: auto;
    min-height: 100vh;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .workspace {
    overflow: visible;
    grid-template-columns: 1fr;
  }

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

  .terminal-panel {
    min-height: 55vh;
  }

  #terminal {
    height: 55vh;
    min-height: 55vh;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 14px 16px;
  }

  .connection-panel {
    padding: 17px;
  }

  .actions {
    grid-template-columns: 1fr;
  }
}


.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 10, 0.82);
  backdrop-filter: blur(8px);
}

.auth-card {
  width: min(430px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #11161f;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.auth-card h2 {
  margin-bottom: 8px;
}

.auth-description {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-description code {
  color: #cdd6e2;
}

.auth-submit {
  width: 100%;
  margin-top: 18px;
}

.auth-error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.45;
}
