/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Base */
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  min-height: 100vh;
  padding: 2rem;
}

/* Typography */
h1 { font-size: 1.5rem; font-weight: 600; color: #f8fafc; letter-spacing: -0.02em; }
h1 span { color: #6366f1; }

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.header-title { display: flex; flex-direction: column; gap: 0.1rem; }

.header-sub {
  font-size: 0.7rem;
  color: #475569;
}

/* Cards */
.card {
  background: #1e2130;
  border: 1px solid #2d3148;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.card h2 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 1.25rem;
}

/* Forms */
.form-row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
label { font-size: 0.75rem; color: #94a3b8; font-weight: 500; }

input[type="text"],
input[type="url"],
input[type="password"] {
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus { border-color: #6366f1; }
input::placeholder { color: #475569; }

/* Buttons */
button {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  transition: opacity 0.15s;
}

button:hover { opacity: 0.85; }
.btn-primary { background: #6366f1; color: #fff; }
.btn-danger  { background: #7f1d1d; color: #fca5a5; }
.btn-edit    { background: #1a3a2a; color: #6ee7b7; }
.btn-open    { background: #1e3a5f; color: #7dd3fc; border: 1px solid #1e5f8a; }
.btn-sm      { padding: 0.3rem 0.65rem; font-size: 0.75rem; }
.btn-cancel  { background: #2d3148; color: #94a3b8; }

/* Status messages */
#msg {
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-top: 0.75rem;
  display: none;
}

#msg.ok    { background: #1a3a2a; color: #6ee7b7; display: block; }
#msg.error { background: #7f1d1d; color: #fca5a5; display: block; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em; 
  color: #64748b;
  border-bottom: 1px solid #2d3148;
}

td { padding: 0.65rem 0.75rem; border-bottom: 1px solid #1a1f2e; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #252840; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-active   { color: #22c55e; }
.status-active   .status-dot { background: #22c55e; animation: pulse 2s infinite; }
.status-inactive { color: #f87171; }
.status-inactive .status-dot { background: #f87171; }
.status-pending  { color: #475569; font-size: 0.8rem; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.name-cell { font-weight: 500; }
.url-cell  { font-family: monospace; font-size: 0.8rem; color: #94a3b8; }
.desc-cell { font-size: 0.82rem; color: #64748b; }
.actions   { display: flex; gap: 0.4rem; }
.version-badge         { display: inline-block; font-family: monospace; font-size: .75rem; padding: .15rem .5rem; border-radius: 4px; background: #1e3a5f; color: #7dd3fc; }
.version-badge.loading { background: #1e2537; color: #475569; }
.version-badge.error   { background: #1e2537; color: #475569; }
.ws-cell   { font-family: monospace; font-size: 0.78rem; color: #7dd3fc; white-space: nowrap; }
.ws-cell code { background: none; }
.btn-copy  { background: none; border: 1px solid #334155; color: #94a3b8; cursor: pointer; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.75rem; margin-left: 0.35rem; }
.btn-copy:hover { border-color: #7dd3fc; color: #7dd3fc; }
.empty     { color: #475569; font-size: 0.85rem; padding: 1.5rem 0.75rem; text-align: center; }

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay.active { display: flex; }

.modal {
  background: #1e2130;
  border: 1px solid #2d3148;
  border-radius: 12px;
  padding: 1.75rem;
  width: 460px;
  max-width: 95vw;
}

.modal h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; color: #f8fafc; }
.modal .field { margin-bottom: 0.85rem; }
.modal .field input { width: 100%; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.25rem; }

/* Field widths */
.field-name input { width: 180px; }
.field-url  input { width: 320px; font-family: monospace; font-size: 0.82rem; }
.field-desc input { width: 240px; }



/* Navigation */
nav { display: flex; gap: 0.5rem; align-items: center; }

nav a {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: 1px solid transparent;
  color: #94a3b8;
}

nav a.active { background: #1e2130; border-color: #2d3148; color: #e2e8f0; }
nav a:not(.active):hover { background: #1e2130; color: #e2e8f0; }
nav .sep { width: 1px; height: 1.2rem; background: #2d3148; margin: 0 0.25rem; }
nav a.logout { color: #475569; }
nav a.logout:hover { color: #94a3b8; }