:root {
  color-scheme: dark;
  --bg: #14161a;
  --panel: #1d2026;
  --panel-strong: #242832;
  --text: #f1f4f8;
  --muted: #aeb7c4;
  --border: #343a46;
  --accent: #43c1a7;
  --accent-strong: #2ea78d;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

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

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 0 38%, rgba(255, 255, 255, 0.2) 38% 52%, transparent 52%),
    var(--accent);
}

.brand h1,
.terminal-header h2,
.brand p,
.eyebrow {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.3;
}

.brand p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #111318;
  color: var(--text);
  padding: 0 11px;
}

.toolbar {
  display: flex;
  gap: 10px;
}

button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

button:disabled {
  color: #69717d;
  cursor: not-allowed;
}

.device-list {
  display: grid;
  gap: 10px;
  overflow: auto;
}

.device-button {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 5px;
  padding: 12px;
}

.device-button strong {
  font-size: 15px;
}

.device-button span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.device-button .device-health {
  font-weight: 600;
}

.device-button .device-health.online {
  color: var(--accent);
}

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

.device-button .device-health.unknown {
  color: #d9b15b;
}

.device-button.active {
  border-color: var(--accent);
  background: rgba(67, 193, 167, 0.12);
}

.terminal-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.terminal-header {
  min-height: 76px;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #181b20;
}

.terminal-header h2 {
  font-size: 20px;
}

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

.terminal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.state {
  min-width: 72px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.state.online {
  color: var(--accent);
}

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

.terminal {
  min-height: 0;
  padding: 12px;
  background: #090a0d;
}

.xterm {
  height: 100%;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(520px, 1fr);
  }

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

  .terminal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .terminal-actions {
    width: 100%;
    justify-content: space-between;
  }
}
