:root {
  --bg: #0f1115;
  --fg: #e5e9f0;
  --fg-muted: #9aa4c4;
  --accent: #64b5f6;
  --card-bg: #171b24;
  --card-border: #1f2430;
  --shadow: rgba(5, 8, 14, 0.65);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

.container {
  width: min(1100px, 90vw);
  margin: 0 auto;
}

.site-header {
  background: #11151c;
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 12px 24px -12px var(--shadow);
}

.site-header .brand {
  margin: 0;
  font-size: 1.8rem;
}

.main-nav {
  display: flex;
  gap: 1rem;
}

.main-nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-weight: 600;
}

.main-nav a:hover {
  color: var(--accent);
}

.site-header .container,
.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 0;
}

.page {
  padding: 2.5rem 0 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero h2 {
  margin-bottom: 0.5rem;
  font-size: 2.2rem;
}

.hero p {
  margin: 0 auto;
  max-width: 600px;
  color: var(--fg-muted);
}

.cards-grid {
  display: grid;
  gap: 1.8rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 18px 35px -20px var(--shadow);
  overflow: hidden;
}

.card-title {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.device-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin: 0 0 1.2rem 0;
}

.telemetry-grid dt {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
}

.telemetry-grid dd {
  margin: 0.15rem 0 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.badge-good,
.badge-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.badge-good {
  background: rgba(79, 209, 197, 0.12);
  color: #4fd1c5;
}

.badge-warn {
  background: rgba(229, 83, 83, 0.12);
  color: #f87171;
}

.device-name {
  font-weight: 600;
}

.device-meta {
  display: block;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  color: var(--fg-muted);
}

.command-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 1.2rem;
  padding-top: 1.2rem;
}

.command-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.command-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.command-form input[type="number"] {
  background: #11151c;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--fg);
  padding: 0.35rem 0.6rem;
  width: 90px;
}

.command-row {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  color: #f8fafc;
}

.btn.primary {
  background: linear-gradient(135deg, #3d6dff, #7aa2ff);
  box-shadow: 0 12px 22px -12px rgba(122, 162, 255, 0.6);
}

.btn.primary:hover,
.btn.primary:focus {
  transform: translateY(-1px);
  box-shadow: 0 16px 25px -12px rgba(122, 162, 255, 0.7);
}

.btn.danger {
  background: linear-gradient(135deg, #e55353, #ff7a7a);
  box-shadow: 0 12px 22px -12px rgba(229, 83, 83, 0.6);
}

.btn.danger:hover,
.btn.danger:focus {
  transform: translateY(-1px);
  box-shadow: 0 16px 25px -14px rgba(229, 83, 83, 0.75);
}

.btn.subtle {
  background: rgba(100, 181, 246, 0.15);
  color: var(--fg);
}

.btn.subtle:hover,
.btn.subtle:focus {
  background: rgba(100, 181, 246, 0.25);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.command-feedback {
  min-height: 1.2rem;
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
  color: var(--fg-muted);
}

.command-feedback[data-tone="success"] {
  color: #4fd1c5;
}

.command-feedback[data-tone="error"] {
  color: #f87171;
}

.command-feedback[data-tone="warn"] {
  color: #f6e05e;
}

.command-history {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 1.2rem;
  padding-top: 1.2rem;
}

.command-history ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.command-history li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.95rem;
}

.timestamp {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.command-name {
  font-weight: 600;
}

.status-pill {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-queued {
  background: rgba(122, 162, 255, 0.15);
  color: #7aa2ff;
}

.status-sent {
  background: rgba(255, 214, 102, 0.15);
  color: #f6e05e;
}

.status-completed {
  background: rgba(79, 209, 197, 0.15);
  color: #4fd1c5;
}

.status-failed {
  background: rgba(229, 83, 83, 0.15);
  color: #f87171;
}

.command-note {
  color: var(--fg-muted);
  font-style: italic;
}

code {
  background: rgba(100, 181, 246, 0.1);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  color: var(--accent);
}

.site-footer {
  background: #11151c;
  border-top: 1px solid var(--card-border);
  color: var(--fg-muted);
}

.empty-state.small {
  font-size: 0.85rem;
}

.snapshot-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.snapshot-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.snapshot-preview img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  box-shadow: 0 12px 24px -12px var(--shadow);
}

.snapshot-meta {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.snapshot-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.file-browser {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.file-browser__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.file-browser__header h2 {
  margin: 0 0 0.25rem 0;
}

.file-browser__path {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.file-upload {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-upload__button {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(100, 181, 246, 0.15);
  color: var(--fg);
  padding: 0.4rem 0.95rem;
  cursor: pointer;
  font-weight: 600;
}

.file-upload__button input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-parent a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.file-parent a:hover {
  text-decoration: underline;
}

.file-browser__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.file-folder {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.file-folder input[type="text"],
.file-action-details input[type="text"] {
  background: #11151c;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--fg);
  padding: 0.35rem 0.6rem;
}

.file-folder input[type="text"]::placeholder,
.file-action-details input[type="text"]::placeholder {
  color: var(--fg-muted);
}

.file-alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 12px 22px -14px var(--shadow);
}

.file-alert--success {
  background: rgba(79, 209, 197, 0.15);
  color: #4fd1c5;
  border: 1px solid rgba(79, 209, 197, 0.3);
}

.file-alert--error {
  background: rgba(229, 83, 83, 0.15);
  color: #f87171;
  border: 1px solid rgba(229, 83, 83, 0.3);
}

.file-table-wrapper {
  overflow-x: auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 18px 35px -20px var(--shadow);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.file-table th,
.file-table td {
  padding: 0.9rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.file-table thead th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}

.file-table tbody tr:hover {
  background: rgba(100, 181, 246, 0.05);
}

.file-table__size,
.file-table__modified,
.file-table__actions {
  white-space: nowrap;
}

.file-table__actions .btn {
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.file-action-details {
  position: relative;
  display: inline-block;
}

.file-action-details summary {
  list-style: none;
  cursor: pointer;
}

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

.file-action-details[open] > summary {
  background: rgba(100, 181, 246, 0.25);
}

.file-action-details form {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.file-table__empty {
  text-align: center;
  color: var(--fg-muted);
}

.file-icon {
  display: inline-block;
  margin-right: 0.5rem;
  min-width: 3rem;
  font-family: "Courier New", Courier, monospace;
}

@media (max-width: 720px) {
  .file-table,
  .file-table thead {
    display: none;
  }

  .file-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1rem;
  }

  .file-table tr {
    display: grid;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.9rem;
    border-radius: 10px;
  }

  .file-table td {
    border: none;
    padding: 0;
  }

  .file-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--fg-muted);
    margin-bottom: 0.15rem;
  }
}
