:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --panel: rgba(255, 252, 245, 0.88);
  --line: rgba(49, 40, 31, 0.12);
  --text: #241d17;
  --muted: #6c6258;
  --accent: #b04a2f;
  --accent-strong: #8b341e;
  --ok: #246a3d;
  --warn: #9a5c0f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(176, 74, 47, 0.16), transparent 26%),
    radial-gradient(circle at bottom right, rgba(36, 106, 61, 0.14), transparent 22%),
    linear-gradient(180deg, #f8f1e7 0%, var(--bg) 100%);
}

.container {
  max-width: 760px;
  margin: 48px auto;
  padding: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 18px 60px rgba(44, 31, 18, 0.08);
  backdrop-filter: blur(10px);
}

h1 {
  margin: 0 0 12px;
  font-size: 2.2rem;
  line-height: 1.1;
}

p, label, input, button, table {
  font-size: 1rem;
}

p.lead {
  margin: 0 0 24px;
  color: var(--muted);
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(36, 29, 23, 0.16);
  background: rgba(255, 255, 255, 0.86);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

button:disabled:hover {
  background: inherit;
  transform: none;
}

button.secondary {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid rgba(176, 74, 47, 0.24);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.status {
  min-height: 24px;
  color: var(--muted);
}

.status.error {
  color: #972d2d;
}

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

pre.code {
  margin: 14px 0 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(36, 106, 61, 0.12);
  color: var(--ok);
}

.badge.warn {
  background: rgba(154, 92, 15, 0.14);
  color: var(--warn);
}

.muted {
  color: var(--muted);
}

/* Devices table: avoid overflowing the panel for long fingerprints */
#devices-list {
  width: 100%;
  overflow-x: auto;
}

#devices-list table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* allow cells to wrap instead of expanding */
}

#devices-list th, #devices-list td {
  word-break: break-word;
  white-space: normal;
  overflow-wrap: anywhere;
}

#devices-list td code {
  display: block;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
  font-family: Consolas, "Courier New", monospace;
}

#devices-list td .muted {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .container {
    margin: 20px auto;
    padding: 16px;
  }

  .panel {
    padding: 20px;
    border-radius: 16px;
  }

  h1 {
    font-size: 1.8rem;
  }
}
