:root {
  --bg: #6f8586;
  --panel: #2a303a;
  --panel-border: #404b59;
  --text: #e6edf7;
  --muted: #b2c1d4;
  --accent: #49b7ff;
  --ok: #23c36b;
  --bad: #db3a34;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 18% 20%, #8ea5a6 0%, var(--bg) 58%);
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.1rem 1rem 1.4rem;
}

.hero {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: linear-gradient(90deg, #87989b 0%, #9badb0 100%);
  border: 1px solid #6f858a;
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.auth-brand {
  justify-content: center;
}

.logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.logo-wide {
  width: 228px;
  height: 60px;
}

.eyebrow {
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
  font-size: 0.8rem;
}

h1 {
  margin: 0.15rem 0 0;
  font-size: 1.7rem;
}

.runtime-version {
  margin: 0.3rem 0 0;
  color: #d7e2ef;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  opacity: 0.92;
}

.subtitle {
  margin-top: 0.75rem;
  color: var(--muted);
}

.header-button {
  border: 1px solid #5a6a7d;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  color: var(--text);
  background: rgba(20, 28, 36, 0.72);
  font-weight: 700;
  cursor: pointer;
}

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

.card {
  background: linear-gradient(180deg, #313846 0%, var(--panel) 100%);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 0.85rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

h2 {
  margin-top: 0;
  margin-bottom: 0.7rem;
  font-size: 1.2rem;
}

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

.status-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.led-red {
  color: var(--bad);
  background: var(--bad);
}

.led-green {
  color: var(--ok);
  background: var(--ok);
}

.hint {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.save-status {
  min-height: 1rem;
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

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

.save-status.err {
  color: #ff8b85;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(460px, 100%);
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(180deg, #313846 0%, var(--panel) 100%);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.auth-copy {
  display: grid;
  gap: 0.25rem;
}

.auth-copy .subtitle {
  margin: 0;
}

.auth-form {
  gap: 0.9rem;
}

.auth-error {
  min-height: 1.25rem;
  margin: 0;
}

.form {
  display: grid;
  gap: 0.55rem;
}

.form-group {
  margin: 0;
  border: 1px dashed #6f98a3;
  border-radius: 14px;
  padding: 0.6rem;
  background: rgba(16, 31, 40, 0.28);
  display: grid;
  gap: 0.5rem;
}

.form-group legend {
  padding: 0 0.35rem;
  color: #b9d5df;
  font-weight: 600;
  font-size: 0.9rem;
}

.form label {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
}

.form small {
  color: var(--muted);
  font-size: 0.85rem;
}

.form input {
  width: 100%;
  border: 1px solid #5a6a7d;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  color: var(--text);
  background: #1d242e;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 3rem;
}

.password-field input[type="password"]::-ms-reveal,
.password-field input[type="password"]::-ms-clear {
  display: none;
}

.password-field input[type="password"]::-webkit-credentials-auto-fill-button,
.password-field input[type="password"]::-webkit-textfield-decoration-container {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

.form .password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.form .password-toggle:hover,
.form .password-toggle:focus-visible {
  background: rgba(73, 183, 255, 0.14);
}

.form .password-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
}

.form select {
  width: 100%;
  border: 1px solid #5a6a7d;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  color: var(--text);
  background: #1d242e;
}

.form button {
  margin-top: 0.35rem;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: #072337;
  background: linear-gradient(90deg, #44d4f0 0%, #00b4d8 100%);
  font-weight: 700;
  cursor: pointer;
  opacity: 1;
}

.form button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.input-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.profile-controls .secondary-button {
  min-width: 128px;
}

.secondary-button {
  margin-top: 0;
  min-width: 116px;
  color: var(--text);
  background: linear-gradient(90deg, #315c72 0%, #3f7d9d 100%);
}

.discovery-panel {
  display: grid;
  gap: 0.4rem;
}

.warn-text {
  color: #ffd27a;
}

.candidate-list {
  display: grid;
  gap: 0.45rem;
}

.candidate-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.6rem;
  border: 1px solid #4e6474;
  border-radius: 10px;
  background: rgba(13, 22, 29, 0.55);
}

.candidate-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(73, 183, 255, 0.35);
}

.candidate-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

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

  .header-button {
    width: 100%;
  }
}

.candidate-address {
  font-weight: 700;
  color: var(--text);
}

.candidate-meta {
  color: var(--muted);
  font-size: 0.83rem;
}

.candidate-action {
  justify-self: start;
  margin-top: 0;
  padding: 0.5rem 0.75rem;
  min-width: 126px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(7, 14, 20, 0.72);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: linear-gradient(180deg, #313846 0%, var(--panel) 100%);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
}

.modal-card h2 {
  margin: 0;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.modal-actions button {
  margin-top: 0;
  min-width: 112px;
}

.bg-orb {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.5;
}

.bg-orb-1 {
  width: 340px;
  height: 340px;
  right: -100px;
  top: -90px;
  background: #5f8e8d;
}

.bg-orb-2 {
  width: 300px;
  height: 300px;
  left: -90px;
  bottom: -120px;
  background: #8ba8a8;
}

@media (max-width: 680px) {
  .input-with-button {
    grid-template-columns: 1fr;
  }

  .secondary-button,
  .candidate-action {
    width: 100%;
  }
}
