:root {
  color-scheme: dark;
  --bg: #0f1215;
  --panel: #171c21;
  --panel-2: #20272e;
  --border: #313b45;
  --text: #eef2f4;
  --muted: #a8b4bf;
  --accent: #36c58b;
  --accent-2: #579dff;
  --danger: #ff6868;
  --terminal-bg: #080b0e;
}

* {
  box-sizing: border-box;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font: inherit;
}

input {
  min-height: 40px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

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

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

.shell {
  width: min(1360px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0;
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr);
  gap: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.support-message {
  margin: 8px 0 0;
  color: var(--muted);
}

.connection-state {
  min-width: 148px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.connection-state.connected {
  color: var(--text);
}

.connection-state.connected .status-dot {
  background: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
}

.stat {
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 12px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font: 700 22px/1.2 Consolas, "Cascadia Mono", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}

.command-panel {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.command-panel form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.command-panel input {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
}

.panel-header {
  min-height: 56px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

.login-shell {
  min-height: 100vh;
  width: min(100% - 28px, 420px);
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.login-panel {
  width: 100%;
  display: grid;
  gap: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 22px;
}

.table-wrap {
  min-height: 0;
  overflow: auto;
  background: var(--terminal-bg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font: 14px/1.45 Consolas, "Cascadia Mono", "Courier New", monospace;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #1e252c;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #13191f;
  color: var(--muted);
  font: 600 12px/1.2 "Segoe UI", Arial, sans-serif;
}

td.hex {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #d8ecff;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 1360px);
    padding: 10px 0;
  }

  .topbar {
    display: grid;
  }

  .connection-state {
    width: 100%;
    justify-content: start;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .command-panel form {
    grid-template-columns: 1fr;
  }
}
