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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0b14;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.card {
  background: #13141f;
  border: 1px solid #1e2235;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.logo {
  margin-bottom: 32px;
  text-align: center;
}

.logo-svg {
  height: 36px;
  width: auto;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #ffffff;
}

.subtitle {
  font-size: 14px;
  color: #6b7090;
  margin-bottom: 28px;
  line-height: 1.5;
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #9ca0b8;
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
}

.eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #4a4e6a;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.eye-btn:hover,
.eye-btn.active {
  color: #3de8c4;
}

.eye-btn .eye-closed {
  display: none;
}

.eye-btn.active .eye-open {
  display: none;
}

.eye-btn.active .eye-closed {
  display: block;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 11px 42px 11px 14px;
  background: #0d0e1a;
  border: 1px solid #1e2235;
  border-radius: 8px;
  font-size: 15px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="password"]::placeholder,
input[type="text"]::placeholder {
  color: #3a3d55;
}

input[type="password"]:focus,
input[type="text"]:focus {
  border-color: #3de8c4;
  box-shadow: 0 0 0 3px rgba(61, 232, 196, 0.1);
}

.requirements {
  list-style: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.requirements li {
  font-size: 12px;
  color: #4a4e6a;
  padding-left: 18px;
  position: relative;
  transition: color 0.15s;
}

.requirements li::before {
  content: "×";
  position: absolute;
  left: 0;
  color: #4a4e6a;
  font-weight: 700;
  transition: color 0.15s;
}

.requirements li.met {
  color: #3de8c4;
}

.requirements li.met::before {
  content: "✓";
  color: #3de8c4;
}

button[type="submit"] {
  margin-top: 8px;
  padding: 12px;
  background: linear-gradient(135deg, #3de8c4, #7c6cf5);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.01em;
}

button[type="submit"]:hover {
  opacity: 0.9;
}

button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.message {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.message.success {
  background: rgba(61, 232, 196, 0.08);
  color: #3de8c4;
  border: 1px solid rgba(61, 232, 196, 0.2);
}

.message.error {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.message.info {
  background: rgba(124, 108, 245, 0.08);
  color: #a89cf7;
  border: 1px solid rgba(124, 108, 245, 0.2);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(124, 108, 245, 0.3);
  border-top-color: #7c6cf5;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* ── Test page ──────────────────────────────────────────────────────────── */

.card-wide {
  max-width: 560px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: #4a4e6a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px 16px;
  margin-bottom: 4px;
}

.info-label {
  font-size: 12px;
  color: #6b7090;
  font-weight: 500;
  padding-top: 3px;
}

.info-value {
  font-size: 13px;
  color: #e2e4f0;
  word-break: break-all;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-teal  { background: rgba(61, 232, 196, 0.1); color: #3de8c4; }
.badge-purple { background: rgba(124, 108, 245, 0.1); color: #a89cf7; }
.badge-red   { background: rgba(239, 68, 68, 0.1);  color: #f87171; }
.badge-grey  { background: rgba(107, 112, 144, 0.1); color: #6b7090; }

.divider {
  border: none;
  border-top: 1px solid #1e2235;
  margin: 22px 0;
}

.token-box {
  background: #0d0e1a;
  border: 1px solid #1e2235;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: monospace;
  font-size: 11px;
  color: #4a4e6a;
  word-break: break-all;
  line-height: 1.6;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.token-box:hover {
  border-color: #3de8c4;
  color: #9ca0b8;
}

.token-hint {
  font-size: 11px;
  color: #4a4e6a;
  margin-top: 6px;
  text-align: right;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-secondary {
  flex: 1;
  padding: 10px;
  background: #1a1c2e;
  color: #9ca0b8;
  border: 1px solid #1e2235;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-secondary:hover {
  background: #1e2235;
  color: #ffffff;
  border-color: #2a2e47;
}

.btn-danger {
  flex: 1;
  padding: 10px;
  background: rgba(239, 68, 68, 0.06);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

.qr-wrap {
  text-align: center;
  margin: 16px 0 12px;
}

.qr-wrap img {
  width: 176px;
  height: 176px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.secret-box {
  background: #0d0e1a;
  border: 1px solid #1e2235;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: monospace;
  font-size: 13px;
  color: #a89cf7;
  text-align: center;
  letter-spacing: 0.12em;
  word-break: break-all;
  margin-bottom: 14px;
}

.totp-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── Portal nav ─────────────────────────────────────────────────────────── */

.portal-header-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.portal-nav-link {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7090;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.portal-nav-link:hover {
  background: #1a1c2e;
  color: #c8cbe0;
}

.portal-nav-link.active {
  background: #1a1c2e;
  color: #ffffff;
}

/* ── Profile trigger ────────────────────────────────────────────────────── */

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 10px;
  color: #9ca0b8;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.profile-trigger:hover {
  background: #1a1c2e;
  border-color: #1e2235;
  color: #ffffff;
}

/* ── Profile panel ───────────────────────────────────────────────────────── */

.profile-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  justify-content: flex-end;
}

.profile-panel {
  background: #13141f;
  border-left: 1px solid #1e2235;
  width: 100%;
  max-width: 400px;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #1e2235;
  position: sticky;
  top: 0;
  background: #13141f;
  z-index: 1;
}

.profile-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.profile-panel-body {
  padding: 24px;
  flex: 1;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.breadcrumb-btn {
  background: none;
  border: none;
  color: #6b7090;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color 0.12s;
}

.breadcrumb-btn:hover {
  color: #c8cbe0;
}

.breadcrumb-sep {
  color: #2a2e47;
  font-size: 18px;
}

/* ── Search result list ─────────────────────────────────────────────────── */

.search-results-list {
  border: 1px solid #1e2235;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #191b2a;
  transition: background 0.1s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #1a1c2e;
}

/* ── Dashboard ──────────────────────────────────────────────────────────── */

body.dash-page {
  display: block;
  align-items: unset;
  justify-content: unset;
}

.dash-header {
  background: #13141f;
  border-bottom: 1px solid #1e2235;
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-logo {
  height: 26px;
  width: auto;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #9ca0b8;
}

.dash-main {
  max-width: 1120px;
  margin: 32px auto;
  padding: 0 24px;
}

.dash-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dash-title {
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  margin-right: auto;
}

.dash-search input[type="text"] {
  padding: 9px 14px;
  width: 220px;
}

.table-wrap {
  background: #13141f;
  border: 1px solid #1e2235;
  border-radius: 12px;
  overflow: hidden;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #4a4e6a;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid #1e2235;
  white-space: nowrap;
}

.users-table tbody tr {
  border-bottom: 1px solid #191b2a;
  transition: background 0.1s;
}

.users-table tbody tr:last-child {
  border-bottom: none;
}

.users-table tbody tr:hover {
  background: #191b2a;
}

.users-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: #c8cbe0;
  vertical-align: middle;
}

.users-table .td-id {
  font-family: monospace;
  font-size: 11px;
  color: #4a4e6a;
}

.users-table .td-actions {
  text-align: right;
  white-space: nowrap;
}

.btn-xs {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid #1e2235;
  background: #1a1c2e;
  color: #9ca0b8;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.btn-xs:hover {
  background: #222540;
  color: #fff;
}

.btn-xs-danger {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.06);
}

.btn-xs-danger:hover {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-primary {
  padding: 9px 18px;
  background: linear-gradient(135deg, #3de8c4, #7c6cf5);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn-primary:hover {
  opacity: 0.88;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 13px;
  color: #6b7090;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #4a4e6a;
  font-size: 14px;
}

/* Modal */

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

.modal {
  background: #13141f;
  border: 1px solid #1e2235;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.5);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.modal-close {
  background: none;
  border: none;
  color: #4a4e6a;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

.modal-close:hover {
  color: #ffffff;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group label {
  margin-bottom: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

select {
  width: 100%;
  padding: 11px 14px;
  background: #0d0e1a;
  border: 1px solid #1e2235;
  border-radius: 8px;
  font-size: 15px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

select:focus {
  border-color: #3de8c4;
  box-shadow: 0 0 0 3px rgba(61, 232, 196, 0.1);
}

input[type="email"] {
  width: 100%;
  padding: 11px 14px;
  background: #0d0e1a;
  border: 1px solid #1e2235;
  border-radius: 8px;
  font-size: 15px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="email"]::placeholder {
  color: #3a3d55;
}

input[type="email"]:focus {
  border-color: #3de8c4;
  box-shadow: 0 0 0 3px rgba(61, 232, 196, 0.1);
}

.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
