@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500&display=swap');

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 300;
  margin: 0;
  padding: 2rem 1rem;
  background: #0a0a0a;
  color: #d8d8d8;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.card {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  background: #101010;
  border: 1px solid #1c1c1c;
  border-radius: 14px;
  padding: 2.5rem 2.25rem;
}

header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: #d8d8d8;
}

.subtitle {
  margin: 0.5rem 0 0;
  color: #4a4a4a;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.terms {
  background: #0d0d0d;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  max-height: 320px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #9a9a9a;
}
.terms h2 {
  font-size: 0.92rem;
  font-weight: 400;
  margin: 1rem 0 0.4rem;
  color: #d8d8d8;
}
.terms h2:first-child { margin-top: 0; }
.terms ul { padding-left: 1.2rem; }

.consent-block {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: #141414;
  border: 1px solid #1c1c1c;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  color: #9a9a9a;
}
.checkbox input { margin-top: 0.2rem; flex-shrink: 0; accent-color: #6b6b6b; }

button {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.85rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 400;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }

button.ghost {
  background: transparent;
  color: #6b6b6b;
  border: 1px solid #1c1c1c;
}

button.consent {
  width: 100%;
  font-size: 0.95rem;
  font-weight: 400;
  background: #141414;
  color: #d8d8d8;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.95rem 1.5rem;
}
button.consent:hover:not(:disabled) {
  background: #161616;
  border-color: #262626;
}
button.consent .pdf-icon { flex-shrink: 0; color: #8b1d1d; }
button.consent .btn-label { text-decoration: none; color: #d8d8d8; }

button.primary {
  width: 100%;
  padding: 0.95rem 1rem;
  font-size: 0.95rem;
  font-weight: 400;
  background: #141414;
  color: #d8d8d8;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  cursor: pointer;
}
button.primary:hover:not(:disabled) {
  background: #161616;
  border-color: #262626;
}
button.primary:disabled { background: #0f0f0f; color: #4a4a4a; cursor: wait; }
button.primary p { margin: 0; }

.result {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid #1c1c1c;
}
.result h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 400;
  color: #9a9a9a;
}
.result p {
  margin: 0;
  color: #4a4a4a;
  font-size: 0.85rem;
  line-height: 1.6;
}
.result.ok { color: #9a9a9a; }
.result.err { color: #9a9a9a; }
.result dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 0.75rem 0 0;
}
.result dt {
  font-weight: 400;
  color: #6b6b6b;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.result dd {
  margin: 0;
  color: #9a9a9a;
  font-size: 0.85rem;
}
.result code {
  display: inline-block;
  background: #0d0d0d;
  border: 1px solid #1c1c1c;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  word-break: break-all;
  color: #6b6b6b;
}
.hint {
  margin-top: 1rem;
  color: #4a4a4a;
  font-size: 0.8rem;
}

.hidden { display: none !important; }

.intro {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  background: #0d0d0d;
  border-left: 2px solid #262626;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #9a9a9a;
}
.intro p { margin: 0; }

.qr-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #0d0d0d;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  text-align: center;
}
.qr-box h2 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #4a4a4a;
}
.qr-img {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: #d8d8d8;
  padding: 0.5rem;
  border-radius: 0.5rem;
}
.qr-url { margin: 0.75rem 0 0.25rem; word-break: break-all; }
.qr-url code {
  background: transparent;
  border: 0;
  padding: 0;
  color: #3e3e3e;
  font-size: 0.78rem;
}

/* Admin shell — sidebar + content */
body.admin-body {
  display: block;
  padding: 0;
  background: #0a0a0a;
}
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0d0d0d;
  border-right: 1px solid #1c1c1c;
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.25rem 1rem;
  border-bottom: 1px solid #1c1c1c;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #141414;
  border: 1px solid #1c1c1c;
  color: #d8d8d8;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.brand-name {
  color: #9a9a9a;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: transparent;
  border: 1px solid transparent;
  color: #6b6b6b;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.nav-item:hover {
  background: #141414;
  color: #d8d8d8;
}
.nav-item.active {
  background: #141414;
  color: #d8d8d8;
  border-color: #262626;
}
.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2a2a2a;
  flex-shrink: 0;
}
.nav-item.active .nav-dot { background: #d8d8d8; }

.sidebar-foot {
  margin-top: auto;
  padding: 0.9rem 0.85rem;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.meta-mini {
  color: #4a4a4a;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sidebar-foot strong {
  color: #d8d8d8;
  font-weight: 400;
  font-size: 1.1rem;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-head {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.panel-head h1 { margin: 0; }
.panel-head .meta { margin: 0; }

.table-wrap {
  overflow-x: auto;
}

/* Reports tab */
.report-card {
  background: #0d0d0d;
  border: 1px solid #1c1c1c;
  border-radius: 12px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  max-width: 720px;
}
.report-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.report-summary .stat {
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.stat-label {
  color: #4a4a4a;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.report-summary .stat strong {
  color: #d8d8d8;
  font-weight: 400;
  font-size: 1.4rem;
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.report-label {
  color: #4a4a4a;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.9rem;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 8px;
  cursor: pointer;
  color: #9a9a9a;
  font-size: 0.88rem;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.radio:hover { color: #d8d8d8; border-color: #262626; }
.radio input { accent-color: #6b6b6b; }
.report-hint {
  margin: 0;
  color: #6b6b6b;
  font-size: 0.82rem;
  line-height: 1.55;
}
.report-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  width: auto;
  padding: 0.85rem 1.5rem;
}

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
  }
  .sidebar-brand { padding: 0 0.5rem 0 0; border-bottom: 0; border-right: 1px solid #1c1c1c; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .sidebar-foot { margin: 0; }
  .report-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Admin panel — same dark palette */
.admin {
  width: 100%;
  margin: 0 auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 2rem 2.5rem;
}
.admin h1 {
  margin-top: 0;
  color: #d8d8d8;
  font-weight: 300;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.meta {
  color: #4a4a4a;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.meta strong { color: #d8d8d8; font-weight: 400; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  color: #9a9a9a;
  margin-top: 1rem;
}
th, td {
  border-bottom: 1px solid #1c1c1c;
  padding: 0.7rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
th {
  background: #0d0d0d;
  font-weight: 400;
  color: #4a4a4a;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
tr.withdrawn { opacity: 0.4; }
.ua { max-width: 200px; word-break: break-word; color: #6b6b6b; }
td a { color: #9a9a9a; text-decoration: none; border-bottom: 1px solid #262626; }
td a:hover { color: #d8d8d8; border-color: #4a4a4a; }

.badge {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.05em;
}
.badge.active { background: transparent; color: #6b6b6b; border: 1px solid #262626; }
.badge.revoked { background: transparent; color: #8b1d1d; border: 1px solid #2a1414; }
.empty { color: #4a4a4a; font-style: italic; }

.text-input {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  color: #d8d8d8;
  font-family: inherit;
  font-size: 0.9rem;
}
.text-input:focus {
  outline: none;
  border-color: #3a3a3a;
}

/* Map button (admin table) */
.map-btn {
  background: transparent;
  border: 1px solid #262626;
  color: #9a9a9a;
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.map-btn:hover {
  background: #141414;
  color: #d8d8d8;
  border-color: #3a3a3a;
}

/* Map modal */
.map-modal[hidden] { display: none; }
.map-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.map-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.map-modal-card {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  height: min(640px, 85vh);
  background: #101010;
  border: 1px solid #1c1c1c;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.map-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid #1c1c1c;
}
.map-modal-head h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9a9a9a;
}
.map-modal-close {
  background: transparent;
  border: 0;
  color: #6b6b6b;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
}
.map-modal-close:hover { background: #141414; color: #d8d8d8; }
.map-modal-body { flex: 1; min-height: 0; background: #0d0d0d; }
.map-modal-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Sidebar — user identity block (clickable -> Perfil) */
.sidebar-who {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  background: linear-gradient(180deg, #121212 0%, #0c0c0c 100%);
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.sidebar-who:hover {
  border-color: #2a2a2a;
  background: linear-gradient(180deg, #151515 0%, #0e0e0e 100%);
}
.sidebar-who:active { transform: translateY(1px); }
.sidebar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #2a2a2a, #141414 70%);
  border: 1px solid #2a2a2a;
  color: #d8d8d8;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.sidebar-who-info {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}
.sidebar-who-info strong {
  color: #d8d8d8;
  font-weight: 400;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-who-chev { color: #4a4a4a; flex-shrink: 0; transition: color 0.18s ease, transform 0.18s ease; }
.sidebar-who:hover .sidebar-who-chev { color: #9a9a9a; transform: translateX(2px); }

.role-badge {
  align-self: flex-start;
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid #262626;
  color: #6b6b6b;
  background: transparent;
}
.role-badge.role-super {
  color: #e8c97a;
  border-color: #3a2f14;
  background: linear-gradient(180deg, rgba(168, 132, 50, 0.08), rgba(168, 132, 50, 0));
}

/* Sidebar foot — stats + logout */
.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0;
  background: transparent;
  border: 0;
}
.sidebar-foot-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.85rem;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 8px;
}
.sidebar-foot-stat strong {
  color: #d8d8d8;
  font-weight: 400;
  font-size: 1.1rem;
}
.sidebar-logout-form { margin: 0; }
.sidebar-logout-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid #1c1c1c;
  color: #9a9a9a;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.sidebar-logout-btn:hover {
  background: #1a0e0e;
  color: #d8a5a5;
  border-color: #3a1f1f;
}
.sidebar-logout-btn svg { color: currentColor; }

/* Inputs */
.text-input {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  color: #d8d8d8;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.18s ease;
}
.text-input::placeholder { color: #4a4a4a; }
.text-input:focus { border-color: #3a3a3a; }

/* Checkbox grid (PDF template fields) */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.45rem;
}
.check-grid .checkbox {
  margin: 0;
  padding: 0.55rem 0.8rem;
  font-size: 0.85rem;
}

/* Config tab — definition list */
.config-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.55rem 1.25rem;
  margin: 0;
}
.config-list dt {
  color: #4a4a4a;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding-top: 0.15rem;
}
.config-list dd {
  margin: 0;
  color: #d8d8d8;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.config-list code {
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  word-break: break-all;
  color: #9a9a9a;
}

/* Users tab */
.users-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.user-result {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 8px;
  color: #9a9a9a;
}
.user-result.ok { border-color: #262626; }
.user-result.err { border-color: #2a1414; color: #c08585; }
.user-result h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: #d8d8d8;
}
.user-result dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
}
.user-result dt {
  color: #4a4a4a;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.user-result dd {
  margin: 0;
  font-size: 0.82rem;
}
.user-result code {
  background: transparent;
  border: 0;
  padding: 0;
  color: #d8d8d8;
  font-size: 0.78rem;
  word-break: break-all;
}

/* ============================================================
   Profile tab
   ============================================================ */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 880px;
}
.profile-card {
  background: #0d0d0d;
  border: 1px solid #1c1c1c;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.profile-identity {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 1.25rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(216, 216, 216, 0.04), transparent 60%),
    #0d0d0d;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #2c2c2c, #121212 70%);
  border: 1px solid #2a2a2a;
  color: #e8e8e8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.profile-identity-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.profile-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 400;
  color: #f0f0f0;
  letter-spacing: -0.01em;
}
.profile-handle {
  color: #6b6b6b;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.profile-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.profile-stats .stat-card {
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.profile-stats .stat-card strong {
  color: #d8d8d8;
  font-weight: 400;
  font-size: 1.4rem;
}
.profile-stats .stat-card .stat-date { font-size: 0.95rem; }
.profile-stats .stat-label {
  color: #4a4a4a;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.profile-section-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9a9a9a;
}
.profile-section-text {
  margin: 0;
  color: #8a8a8a;
  font-size: 0.86rem;
  line-height: 1.55;
}
.profile-section-text code {
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #d8d8d8;
}

.profile-link-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.profile-link-row + .profile-link-row {
  border-top: 1px solid #161616;
  padding-top: 0.85rem;
  margin-top: 0.25rem;
}
.profile-link-label {
  color: #4a4a4a;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.profile-link-value {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.profile-link-value code {
  flex: 1 1 auto;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #d8d8d8;
  word-break: break-all;
}

.profile-danger { border-color: #1f1414; }
.profile-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: transparent;
  border: 1px solid #2a1414;
  color: #c08585;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.profile-logout-btn:hover {
  background: #1f1212;
  border-color: #3a1f1f;
  color: #e0a8a8;
}

.map-btn.copied {
  background: #14201a;
  color: #8fc7a3;
  border-color: #1f3a2a;
}

/* ============================================================
   Config tab — grouped sections
   ============================================================ */
.config-grid {
  display: grid;
  gap: 1rem;
  max-width: 880px;
}
.config-section {
  background: #0d0d0d;
  border: 1px solid #1c1c1c;
  border-radius: 12px;
  padding: 1.5rem 1.5rem 1.3rem;
}
.config-section-head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #161616;
}
.config-section-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
  color: #e8e8e8;
  letter-spacing: -0.005em;
}
.config-section-sub {
  margin: 0;
  color: #4a4a4a;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.config-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.config-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  align-items: center;
}
.config-row-stack { grid-template-columns: 1fr; gap: 0.4rem; }
.config-row-label {
  color: #6b6b6b;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.config-row-value {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  color: #d8d8d8;
  font-size: 0.9rem;
}
.config-row-value code {
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #d8d8d8;
  word-break: break-all;
  flex: 1 1 auto;
  min-width: 0;
}
.config-hint {
  margin: 1rem 0 0;
  color: #6b6b6b;
  font-size: 0.82rem;
  line-height: 1.55;
}
.config-hint code {
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.76rem;
  color: #d8d8d8;
}

/* ============================================================
   Credentials modal (user create / rotate)
   ============================================================ */
.cred-modal[hidden] { display: none; }
.cred-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.cred-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cred-modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 201, 122, 0.06), transparent 50%),
    linear-gradient(180deg, #131313 0%, #0c0c0c 100%);
  border: 1px solid #262626;
  border-radius: 16px;
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  overflow: hidden;
  animation: credModalIn 0.22s ease-out both;
}
@keyframes credModalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cred-modal-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.9rem;
  padding: 1.4rem 1.5rem 1rem;
  border-bottom: 1px solid #161616;
}
.cred-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(232, 201, 122, 0.14), rgba(232, 201, 122, 0.04));
  border: 1px solid rgba(232, 201, 122, 0.22);
  color: #e8c97a;
}
.cred-modal-head-text { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.cred-modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 400;
  color: #f0f0f0;
  letter-spacing: -0.005em;
}
.cred-modal-sub {
  margin: 0;
  color: #8a8a8a;
  font-size: 0.82rem;
  line-height: 1.5;
}
.cred-modal-sub strong { color: #e8c97a; font-weight: 500; }
.cred-modal-head .map-modal-close { align-self: start; }

.cred-modal-body {
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}
.cred-field { display: flex; flex-direction: column; gap: 0.45rem; }
.cred-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.cred-field-label {
  color: #6b6b6b;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.cred-field-pill {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e8c97a;
  border: 1px solid rgba(232, 201, 122, 0.3);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  background: rgba(232, 201, 122, 0.06);
}
.cred-field-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: #080808;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  padding: 0.5rem 0.6rem 0.5rem 0.85rem;
}
.cred-field-row--secret {
  border-color: #2a2418;
  background:
    linear-gradient(180deg, rgba(232, 201, 122, 0.04), rgba(232, 201, 122, 0)),
    #080808;
}
.cred-field-row code {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 0;
  color: #d8d8d8;
  font-size: 0.82rem;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
.cred-secret {
  letter-spacing: 0.04em;
  color: #f0e3bf !important;
  font-size: 0.92rem !important;
  user-select: all;
}
.cred-url { color: #d8d8d8; }

.cred-actions { display: inline-flex; gap: 0.35rem; flex-shrink: 0; }
.cred-action {
  background: #141414;
  border: 1px solid #262626;
  color: #c8c8c8;
  padding: 0.4rem 0.75rem;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.cred-action:hover { background: #1a1a1a; color: #f0f0f0; border-color: #3a3a3a; }
.cred-action.copied {
  background: #14201a;
  color: #8fc7a3;
  border-color: #1f3a2a;
}
.cred-action--primary {
  background: rgba(232, 201, 122, 0.12);
  color: #f0d98a;
  border-color: rgba(232, 201, 122, 0.34);
}
.cred-action--primary:hover {
  background: rgba(232, 201, 122, 0.18);
  color: #f7e6a8;
  border-color: rgba(232, 201, 122, 0.5);
}

.cred-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: rgba(232, 201, 122, 0.05);
  border: 1px solid rgba(232, 201, 122, 0.18);
  border-radius: 8px;
  color: #d4be7e;
  font-size: 0.78rem;
  line-height: 1.5;
}
.cred-warning svg { color: #e8c97a; flex-shrink: 0; margin-top: 2px; }

.cred-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 1rem 1.5rem 1.3rem;
  border-top: 1px solid #161616;
}
.cred-confirm {
  background: #f0d98a;
  color: #1a1408;
  border: 1px solid #f0d98a;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.cred-confirm:hover { background: #f7e6a8; border-color: #f7e6a8; }
.cred-confirm:active { transform: translateY(1px); }

/* ============================================================
   Consent PDF upload card
   ============================================================ */
.card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
  color: #e8e8e8;
  letter-spacing: -0.005em;
}
.consent-pdf-card { gap: 1rem; }
.consent-pdf-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.consent-pdf-sub {
  margin: 0.25rem 0 0;
  color: #6b6b6b;
  font-size: 0.82rem;
  line-height: 1.55;
}
.consent-pdf-sub code {
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.76rem;
  color: #d8d8d8;
}

.consent-pdf-current {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  border-radius: 10px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.consent-pdf-current--has {
  border-color: #2a2418;
  background:
    linear-gradient(180deg, rgba(232, 201, 122, 0.04), rgba(232, 201, 122, 0)),
    #0a0a0a;
}
.consent-pdf-current-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #121212;
  border: 1px solid #1c1c1c;
  color: #6b6b6b;
}
.consent-pdf-current--has .consent-pdf-current-icon {
  color: #e8c97a;
  border-color: rgba(232, 201, 122, 0.22);
  background: linear-gradient(180deg, rgba(232, 201, 122, 0.1), rgba(232, 201, 122, 0.02));
}
.consent-pdf-current-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.consent-pdf-current-info strong {
  color: #e8e8e8;
  font-weight: 400;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.consent-pdf-meta {
  color: #6b6b6b;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}
.consent-pdf-current-actions { display: flex; gap: 0.4rem; }

.consent-pdf-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.consent-pdf-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.8rem 1.25rem;
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(255,255,255,0.012) 12px 24px),
    #0a0a0a;
  border: 1.5px dashed #262626;
  border-radius: 12px;
  color: #9a9a9a;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.consent-pdf-drop:hover {
  border-color: #3a3a3a;
  color: #d8d8d8;
}
.consent-pdf-drop.is-dragging {
  border-color: rgba(232, 201, 122, 0.6);
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(232, 201, 122, 0.04) 12px 24px),
    #0a0a0a;
  color: #f0d98a;
}
.consent-pdf-drop svg { color: inherit; opacity: 0.8; }
.consent-pdf-drop-title {
  font-size: 0.92rem;
  color: inherit;
}
.consent-pdf-drop-sub {
  font-size: 0.76rem;
  color: #6b6b6b;
  letter-spacing: 0.02em;
}

.consent-pdf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.consent-pdf-msg {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: #0a0a0a;
  border: 1px solid #1c1c1c;
  color: #9a9a9a;
}
.consent-pdf-msg.ok { color: #8fc7a3; border-color: #1f3a2a; background: #0d1612; }
.consent-pdf-msg.err { color: #d8a5a5; border-color: #2a1414; background: #1a0e0e; }
.consent-pdf-msg.info { color: #c8c8c8; }

/* ============================================================
   Responsive tweaks
   ============================================================ */
@media (max-width: 720px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-identity { flex-direction: column; align-items: flex-start; text-align: left; }
  .config-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .cred-modal-foot { flex-direction: column-reverse; align-items: stretch; }
  .cred-modal-foot .cred-confirm,
  .cred-modal-foot .cred-action { width: 100%; }
  .consent-pdf-head { flex-direction: column; align-items: flex-start; }
  .consent-pdf-current { grid-template-columns: 40px 1fr; }
  .consent-pdf-current-actions { grid-column: 1 / -1; }
}
