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

:root {
  --page-bg:      #003d59;
  --active-bg:    #005277;
  --active-color: #7dd3f0;
  --accent:       #7dd3f0;
  --accent-light: #a5e0f7;
  --text-primary: #111827;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --success:      #22c55e;
  --danger:       #ef4444;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--page-bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
}

/* The AlfredTunnel logotype, cobalto on the white card. Never stretched:
   only its height is set. */
.card-title {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}
.logo { display: block; height: 36px; width: auto; }

/* ── STATUS BAR ──────────────────────────────────────────── */
.status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.status-bar b { color: var(--text-primary); font-weight: 600; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #d1d5db; flex: none;
  transition: background .3s;
}
.dot.live {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34,197,94,.2);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: .5; } }

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: 7px;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
input::placeholder { color: #c1c9d4; }
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,61,89,.18);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select option { background: #fff; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn-row { display: flex; gap: 10px; margin-top: 4px; }
.btn {
  flex: 1;
  padding: 11px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: opacity .15s, transform .1s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary {
  background: #003d59;
  color: #fff;
  border-color: #003d59;
}
.btn-primary:hover { background: #005277; }

/* ── OPEN TUNNELS LIST ───────────────────────────────────── */
.open-list { margin-top: 22px; display: none; }
.open-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13.5px;
}
.open-row .open-name {
  flex: 1;
  color: #003d59;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.open-row .open-name:hover { text-decoration: underline; }
.btn-close {
  flex: none;
  padding: 5px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--danger);
  border: 1px solid #fca5a5;
  border-radius: 6px;
}
.btn-close:hover { background: #fef2f2; }

/* ── OUTPUT MESSAGE ──────────────────────────────────────── */
.output {
  margin-top: 16px;
  font-size: 13px;
  min-height: 18px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid var(--border);
  display: none;
}
.output.show { display: block; }
.output.ok   { color: #16a34a; background: #f0fdf4; border-color: #bbf7d0; }
.output.err  { color: #dc2626; background: #fef2f2; border-color: #fecaca; }

/* ── LOGIN / USER BAR ────────────────────────────────────── */
.view[hidden] { display: none; }
.user-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
#user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link {
  flex: none;
  background: none;
  border: none;
  padding: 0;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #003d59;
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }
.loading {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 24px 0;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  overflow-wrap: anywhere;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: #003d59;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
