/* ============================================================
   Curity OAuth 2.0 Test Client — Styles
   ============================================================ */

/* ── Custom properties ──────────────────────────────────────── */
:root {
  --sidebar-w:     240px;
  --sidebar-bg:    #111827;
  --sidebar-text:  #9ca3af;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(99, 102, 241, 0.18);
  --sidebar-active-border: #6366f1;

  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #e0e7ff;

  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --border-light:  #f1f5f9;

  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-subtle:   #94a3b8;

  --success-bg:    #dcfce7;
  --success-text:  #15803d;
  --error-bg:      #fee2e2;
  --error-text:    #b91c1c;
  --neutral-bg:    #f1f5f9;
  --neutral-text:  #475569;

  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:     0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);

  --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono:          'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
code { font-family: var(--mono); }

/* ── Loading screen ──────────────────────────────────────────── */
#app { min-height: 100vh; }

#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout ──────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar__header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar__logo {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}

.sidebar__badge {
  font-size: 11px;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar__nav {
  flex: 1;
  padding: 10px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  border-right: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e5e7eb;
}

.nav-item--active {
  background: var(--sidebar-active-bg);
  color: #fff;
  border-right-color: var(--sidebar-active-border);
}

.nav-item--locked { opacity: 0.55; }

.nav-item__icon { font-size: 16px; flex-shrink: 0; }
.nav-item__label { flex: 1; }
.nav-item__lock  { font-size: 11px; }

/* Sidebar footer — user info + logout */
.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}

.user-card__avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-card__info  { min-width: 0; }
.user-card__name  { font-size: 13px; font-weight: 600; color: #e5e7eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card__email { font-size: 11px; color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn--logout {
  width: 100%;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.25);
  font-size: 13px;
  padding: 7px 12px;
}
.btn--logout:hover { background: rgba(239, 68, 68, 0.22); }

.btn--copy {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn--copy:hover { background: var(--primary-dark); }

/* ── Main content area ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 44px;
  min-height: 100vh;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.page-header__subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.page-header__subtitle code {
  background: var(--border-light);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}

/* ── Section ─────────────────────────────────────────────────── */
.section { margin-bottom: 32px; }

.section__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

/* ── Stat cards (Home & Admin) ───────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card__icon  { font-size: 22px; margin-bottom: 8px; }
.stat-card__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 4px; }
.stat-card__value { font-size: 20px; font-weight: 700; }
.stat-card__value--small { font-size: 13px; font-weight: 600; word-break: break-all; }

/* ── Page overview grid (Home) ───────────────────────────────── */
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}

.page-card:hover                 { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.page-card--locked               { border-style: dashed; opacity: 0.72; }
.page-card--locked:hover         { transform: none; box-shadow: var(--shadow); }

.page-card__icon   { font-size: 28px; margin-bottom: 10px; }
.page-card__title  { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.page-card__status { margin-bottom: 8px; }

.page-card__claims code {
  display: block;
  font-size: 11px;
  background: var(--border-light);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  word-break: break-word;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge--success { background: var(--success-bg); color: var(--success-text); }
.badge--error   { background: var(--error-bg);   color: var(--error-text); }
.badge--neutral { background: var(--neutral-bg); color: var(--neutral-text); }

/* ── Claims table ────────────────────────────────────────────── */
.claims-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.claims-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-light);
  align-items: baseline;
  font-size: 14px;
}

.claims-row:last-child  { border-bottom: none; }

.claims-row--header {
  background: var(--border-light);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 16px;
}

.claims-row__key code  { font-size: 13px; color: var(--primary); }
.claims-row__value     { word-break: break-all; color: var(--text); font-size: 13px; }

/* ── Token display ───────────────────────────────────────────── */
.token-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.token-block__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}

.token-block__sub-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--border-light);
  border-top: 1px solid var(--border);
}

.token-block__decoded { border-top: 1px solid var(--border); }

/* Signature badge inline with sub-header */
.sig-badge { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; }

/* Small spinner variant for inline use */
.spinner--sm {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-width: 2px;
  vertical-align: middle;
  margin-right: 4px;
}

.token-block__title { font-size: 13px; font-weight: 600; }

.token-block__value {
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
  color: #94a3b8;
  background: #0f172a;
  max-height: 90px;
  overflow: hidden;
  line-height: 1.6;
  user-select: all;
}

/* ── Bar chart (Reports) ─────────────────────────────────────── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding: 16px 20px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.bar-chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar-chart__bar {
  width: 100%;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  opacity: 0.82;
  transition: opacity 0.15s;
}
.bar-chart__bar:hover { opacity: 1; }
.bar-chart__label     { font-size: 11px; color: var(--text-muted); padding-bottom: 8px; }

/* ── Data table (Reports) ────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.table-wrapper--paginated { border-radius: var(--radius) var(--radius) 0 0; }
.table-wrapper--paginated .data-table { border-radius: var(--radius) var(--radius) 0 0; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--border-light); }

/* ── Pagination controls ─────────────────────────────────────── */
.pagination-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--surface);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 13px; color: var(--text-muted);
}
.pagination-bar__left { display: flex; align-items: center; gap: 8px; }
.pagination-bar__right { display: flex; align-items: center; gap: 6px; }
.pagination-bar select {
  padding: 3px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: 13px; cursor: pointer;
}
.pagination-bar button {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px;
  transition: background 0.12s, border-color 0.12s;
}
.pagination-bar button:hover:not(:disabled) { background: var(--border-light); border-color: var(--primary); }
.pagination-bar button:disabled { opacity: 0.4; cursor: default; }
.pagination-bar__page-info { min-width: 90px; text-align: center; }

/* ── Error states ────────────────────────────────────────────── */
.error-card {
  background: var(--surface);
  border: 1px solid #fecaca;
  border-radius: 14px;
  padding: 40px 36px;
  text-align: center;
  max-width: 480px;
  box-shadow: var(--shadow-md);
}

.error-card__icon { font-size: 44px; margin-bottom: 14px; }

.error-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--error-text);
}

.error-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.6;
}

.error-card__detail {
  font-size: 13px !important;
}

.error-card__detail code {
  background: var(--error-bg);
  color: var(--error-text);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.error-card .btn { margin-top: 16px; }

.full-page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .main-content { padding: 24px 20px; }
}

@media (max-width: 640px) {
  :root { --sidebar-w: 58px; }

  .sidebar__badge,
  .nav-item__label,
  .nav-item__lock,
  .user-card__info,
  .btn--logout { display: none; }

  .sidebar__logo { font-size: 14px; }
  .sidebar__header { padding: 14px 10px 12px; }
  .nav-item { padding: 10px; justify-content: center; }
  .nav-item__icon { font-size: 20px; }
  .user-card { justify-content: center; }

  .main-content { padding: 20px 16px; }

  .claims-row { grid-template-columns: 130px 1fr; }
  .claims-row--header { grid-template-columns: 130px 1fr; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Settings page ───────────────────────────────────────────── */
.nav-item--settings {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

/* ============================================================
   HAAPI Login Forms — Dark Mode Theme (toggled via .haapi-login--dark)
   ============================================================ */

.haapi-login--dark {
  --bg:            #0f1117;
  --surface:       #1a1d2e;
  --border:        #2d3148;
  --border-light:  #252839;
  --text:          #e2e8f0;
  --text-muted:    #94a3b8;
  --text-subtle:   #64748b;
  --primary:       #818cf8;
  --primary-dark:  #6366f1;
  --primary-light: rgba(99, 102, 241, 0.12);
  --error-bg:      rgba(239, 68, 68, 0.12);
  --error-text:    #fca5a5;
  --success-bg:    rgba(34, 197, 94, 0.12);
  --success-text:  #86efac;
}

.haapi-login--dark .haapi-login__card {
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

.haapi-login--dark .haapi-login__field input {
  background: #131520;
  border-color: var(--border);
  color: var(--text);
}

.haapi-login--dark .haapi-login__field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18);
}

.haapi-login--dark .haapi-login__field input::placeholder {
  color: var(--text-subtle);
}

.haapi-login--dark .haapi-login__alt-action {
  color: var(--primary);
  background: var(--primary-light);
}

.haapi-login--dark .haapi-login__alt-action:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.18);
}

.haapi-login--dark .haapi-login__selector-btn {
  background: #131520;
  border-color: var(--border);
  color: var(--text);
}

.haapi-login--dark .haapi-login__selector-btn:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 2px 12px rgba(129, 140, 248, 0.12);
}

/* ── Theme Toggle Button ─────────────────────────────────────── */

.haapi-login__theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  z-index: 10;
}

.haapi-login__theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ============================================================
   HAAPI Login Forms
   ============================================================ */

.haapi-login {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 1.5rem;
}

.haapi-login__card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.haapi-login__header {
  text-align: center;
  margin-bottom: 2rem;
}

.haapi-login__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
  margin: 0 0 0.25rem;
}

.haapi-login__subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.haapi-login__heading {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin: 0 0 1.5rem;
}

/* ── Form Fields ─────────────────────────────────────────────── */

.haapi-login__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.haapi-login__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.haapi-login__field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: capitalize;
}

.haapi-login__field input {
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.haapi-login__field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.haapi-login__field input:read-only {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Submit Button ───────────────────────────────────────────── */

.haapi-login__submit {
  margin-top: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.haapi-login__submit:hover:not(:disabled) {
  background: var(--primary-dark);
}

.haapi-login__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.haapi-login__submit--loading {
  position: relative;
  color: transparent;
}

.haapi-login__submit--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Secondary Actions ───────────────────────────────────────── */

.haapi-login__alt-action {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-light);
  border: 1.5px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.haapi-login__alt-action:hover {
  border-color: var(--primary);
  background: #eef2ff;
}

/* ── Links ───────────────────────────────────────────────────── */

.haapi-login__links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.haapi-login__link {
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
}

.haapi-login__link:hover {
  text-decoration: underline;
}

/* ── Selector ────────────────────────────────────────────────── */

.haapi-login__selector {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.haapi-login__selector-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.haapi-login__selector-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.haapi-login__selector-icon {
  font-size: 1.3rem;
}

.haapi-login__selector-label {
  flex: 1;
  text-align: left;
}

/* ── Error ───────────────────────────────────────────────────── */

.haapi-login__error {
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.haapi-login__error p {
  margin: 0;
}

/* ── Info Messages ───────────────────────────────────────────── */

.haapi-login__info {
  background: #e8f4fd;
  color: #1a5276;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.4;
  overflow: hidden;
}

.haapi-login--dark .haapi-login__info {
  background: #1a3a4a;
  color: #b8dff0;
}

.haapi-login__info p {
  margin: 0 0 0.4rem 0;
}

.haapi-login__info p:last-child {
  margin-bottom: 0;
}

.haapi-login__info-label {
  font-weight: 600;
  margin: 0.6rem 0 0.2rem 0;
}

.haapi-login__info-label:first-child {
  margin-top: 0;
}

.haapi-login__json {
  background: #d4ecf7;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0 0.5rem 0;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-all;
}

.haapi-login--dark .haapi-login__json {
  background: #142e3a;
}

.haapi-login__json code {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Loading / Polling ───────────────────────────────────────── */

.haapi-login__loading,
.haapi-login__polling {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.settings-field {
  margin-bottom: 18px;
}

.settings-field__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.settings-field__note {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.settings-field__input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
}

.settings-field__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.settings-field__input:hover:not(:focus) {
  border-color: #cbd5e1;
}

/* ── Copy button (inline) ────────────────────────────────────────────────── */
.copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 2px 6px; cursor: pointer; font-size: 11px; color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}
.copy-btn:hover { background: var(--surface); color: var(--text); }
.copy-btn svg { width: 13px; height: 13px; }

/* ── Attributes preview cell ─────────────────────────────────────────────── */
.attr-preview {
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 11px; color: var(--text-muted); cursor: pointer;
  padding: 2px 4px; border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.attr-preview:hover { background: rgba(99,102,241,0.08); color: var(--text); }

/* ── JSON Modal ──────────────────────────────────────────────────────────── */
.json-modal-backdrop {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(15,23,42,0.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.json-modal {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,0.3));
  width: min(720px, 92vw); max-height: 80vh; display: flex; flex-direction: column;
  animation: slideUp 0.18s ease;
}
.json-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
}
.json-modal__close {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--text-muted); padding: 0 4px; line-height: 1;
}
.json-modal__close:hover { color: var(--text); }
.json-modal__body {
  padding: 16px 18px; overflow: auto; flex: 1;
}
.json-modal__body pre {
  margin: 0; white-space: pre-wrap; word-break: break-all;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  color: var(--text);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
