:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --border: #334155;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  margin-bottom: 1.5rem;
}

header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-top: 0.25rem;
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text);
  font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

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

button {
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 0.4rem;
  background: #334155;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

button:hover { filter: brightness(1.15); }
button.primary { background: var(--accent); color: #052e16; font-weight: 600; }
button.danger { background: var(--danger); }
button.warn { background: var(--warn); color: #2a1a00; }
button.small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.ip-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.9rem 1rem;
  margin: 0.75rem 0 1rem;
}

.ip-box.hidden { display: none; }

.ip-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ip-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ip-iface {
  font-size: 0.85rem;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

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

table.hidden { display: none; }

.spinner {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--muted);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0 0.75rem;
}

.log {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  max-width: 420px;
  z-index: 100;
}

.log .msg {
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  border-radius: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: slideIn 0.2s ease;
}

.log .msg.ok { border-left: 4px solid var(--accent); }
.log .msg.err { border-left: 4px solid var(--danger); }
.log .msg.warn { border-left: 4px solid var(--warn); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  width: min(600px, 92vw);
  max-height: 90vh;
  overflow: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

pre {
  background: #0b1120;
  padding: 0.75rem;
  border-radius: 0.4rem;
  overflow: auto;
  font-size: 0.8rem;
}

@media (max-width: 700px) {
  .actions { flex-direction: column; align-items: stretch; }
  .actions button { width: 100%; }
}
