* { box-sizing: border-box; }
body {
  background: #0a0a14;
  color: #c8c8e0;
  font-family: -apple-system, "Segoe UI", Inter, sans-serif;
  margin: 0;
  min-height: 100vh;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid #ffffff0f;
  background: #0f0f1e;
}
.topnav-brand { font-weight: 700; color: #e8e8f8; }
.topnav-user { color: #8080b0; font-size: 0.85rem; }
.topnav-logout { margin-left: auto; }
.topnav-logout button {
  background: transparent;
  border: 1px solid #ffffff15;
  color: #8080b0;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}
.topnav-logout button:hover { border-color: #8060c040; color: #a080e0; }

main { padding: 24px; max-width: 1100px; margin: 0 auto; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 90vh; }
.login-card {
  background: #12121f;
  border: 1px solid #ffffff0a;
  border-radius: 12px;
  padding: 32px 36px;
  width: 320px;
}
.login-card h1 { font-size: 1.3rem; margin: 0 0 2px; color: #e8e8f8; }
.login-sub { color: #6060a0; font-size: 0.8rem; margin: 0 0 20px; }
.login-error {
  background: #c0406015;
  border: 1px solid #c0406040;
  color: #e08080;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-bottom: 14px;
}
.login-card label { display: block; font-size: 0.75rem; color: #7070a0; margin: 12px 0 4px; }
.login-card input {
  width: 100%;
  background: #0a0a14;
  border: 1px solid #ffffff15;
  border-radius: 6px;
  padding: 8px 10px;
  color: #e0e0f0;
  font-size: 0.9rem;
}
.login-card input:focus { outline: none; border-color: #8060c060; }
.login-card button {
  width: 100%;
  margin-top: 18px;
  background: #8060c0;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { background: #9070d0; }

.flash-messages { margin-bottom: 20px; }
.flash-message {
  background: #40c08015; border: 1px solid #40c08040; color: #60d0a0;
  padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 8px;
}
.form-hint { color: #6060a0; font-size: 0.78rem; margin: -6px 0 12px; }

/* ── Shared page elements ── */
h1 { font-size: 1.3rem; color: #e8e8f8; margin: 0 0 4px; }
h2 { font-size: 1rem; color: #c0c0e0; margin: 28px 0 12px; }
.page-sub { color: #6060a0; font-size: 0.85rem; margin: 0 0 20px; }
.mono { font-family: "SF Mono", "JetBrains Mono", monospace; font-size: 0.85em; }

.data-table { width: 100%; border-collapse: collapse; background: #12121f; border: 1px solid #ffffff0a; border-radius: 10px; overflow: hidden; }
.data-table th { text-align: left; padding: 10px 14px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6060a0; background: #0f0f1c; border-bottom: 1px solid #ffffff08; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #ffffff05; font-size: 0.85rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #ffffff03; }
.empty-row { color: #505070; font-style: italic; text-align: center; padding: 20px; }

.row-actions { display: flex; gap: 10px; align-items: center; }
.row-actions a, .row-actions form { display: inline; }
.link-danger { background: none; border: none; color: #c07070; cursor: pointer; font-size: 0.82rem; padding: 0; text-decoration: underline; }
.link-danger:hover { color: #e09090; }

.status-pill { padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; text-transform: capitalize; }
.status-pill.status-active { background: #40c08015; color: #40c080; }
.status-pill.status-maintenance { background: #c0a04015; color: #c0a040; }
.status-pill.status-retired { background: #ffffff0a; color: #6060a0; }

.owner-badge { font-size: 0.68rem; background: #8060c020; color: #a080e0; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select {
  background: #0a0a14; border: 1px solid #ffffff15; border-radius: 6px;
  padding: 8px 10px; color: #e0e0f0; font-size: 0.85rem;
}
.inline-form button {
  background: #8060c0; color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; font-weight: 600; cursor: pointer; font-size: 0.85rem;
}
.inline-form button:hover { background: #9070d0; }

.checkbox-label { display: inline-flex; align-items: center; gap: 5px; font-size: 0.85rem; color: #8080b0; }

/* ── Pilot account cards ── */
.account-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.account-card { background: #12121f; border: 1px solid #ffffff0a; border-radius: 10px; padding: 16px; }
.account-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.account-card-name { font-weight: 600; color: #d0d0f0; font-size: 0.95rem; }
.account-card-email { color: #6060a0; font-size: 0.75rem; margin-top: 2px; }

.status-dot { font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.status-dot.status-online { background: #40c08018; color: #40c080; }
.status-dot.status-idle { background: #c0a04018; color: #c0a040; }
.status-dot.status-offline { background: #ffffff08; color: #606080; }

.otp-display { display: flex; align-items: center; gap: 10px; background: #0a0a14; border: 1px solid #8060c040; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.otp-code { font-family: "SF Mono", "JetBrains Mono", monospace; font-size: 1.3rem; font-weight: 700; color: #a080e0; letter-spacing: 0.05em; }
.otp-copy { background: transparent; border: 1px solid #ffffff15; color: #8080b0; border-radius: 5px; padding: 3px 10px; font-size: 0.72rem; cursor: pointer; }
.otp-copy:hover { border-color: #8060c040; color: #a080e0; }
.otp-timer { margin-left: auto; color: #6060a0; font-size: 0.75rem; font-family: monospace; }
.otp-error { background: #c0406015; border: 1px solid #c0406040; color: #e08080; padding: 8px 10px; border-radius: 6px; font-size: 0.78rem; margin-bottom: 12px; }

.account-card-actions { display: flex; gap: 8px; }
.account-card-actions button {
  flex: 1; padding: 8px; border-radius: 6px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; border: 1px solid #ffffff15; background: transparent; color: #8080b0;
}
.btn-get-code { background: #8060c0 !important; color: #fff !important; border: none !important; }
.btn-get-code:hover { background: #9070d0 !important; }
.btn-get-code:disabled { opacity: 0.6; cursor: default; }
.btn-toggle-online:hover { border-color: #8060c040; color: #a080e0; }

/* ── Admin dashboard ── */
.admin-nav { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid #ffffff0a; }
.admin-nav-link { color: #7070a0; text-decoration: none; font-size: 0.85rem; font-weight: 600; padding: 8px 14px; border-bottom: 2px solid transparent; }
.admin-nav-link:hover { color: #a080e0; }
.admin-nav-link.active { color: #a080e0; border-bottom-color: #8060c0; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #12121f; border: 1px solid #ffffff0a; border-radius: 10px; padding: 16px 18px; }
.stat-label { font-size: 0.68rem; color: #6060a0; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: #e0e0f8; font-family: "SF Mono", monospace; }
.stat-online { color: #40c080; }
.stat-offline { color: #6060a0; }
@media (max-width: 700px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }

.account-name { font-weight: 600; color: #d0d0f0; }
.account-id { color: #505070; font-size: 0.72rem; margin-top: 2px; }
.no-pilot { color: #404060; font-style: italic; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

.section-card { background: #12121f; border: 1px solid #ffffff0a; border-radius: 10px; overflow: hidden; }
.log-entry { padding: 10px 16px; border-bottom: 1px solid #ffffff05; display: flex; align-items: center; gap: 12px; }
.log-entry:last-child { border-bottom: none; }
.log-time { font-size: 0.7rem; color: #505070; width: 40px; flex-shrink: 0; }
.log-icon { font-size: 0.6rem; flex-shrink: 0; }
.log-icon-success { color: #40c080; }
.log-icon-failure { color: #c07070; }
.log-icon-neutral { color: #606080; }
.log-text { font-size: 0.8rem; color: #9090b0; line-height: 1.5; }
.log-text strong { color: #c0c0e0; }
.log-text .acc { color: #a080e0; }
