/**
 * AZTOOLS Tools Hub — Splash / Login (Juni 2026)
 * Ergänzt ui-toolkit.css
 */
:root {
  --hub-accent: #4f46e5;
  --hub-accent-2: #7c3aed;
  --hub-glow: rgb(79 70 229 / 0.12);
  --hub-radius: 16px;
  --hub-radius-lg: 20px;
  --surface: #ffffff;
  --elevated: #f8fafc;
  --glass: rgb(255 255 255 / 0.88);
  --glass-border: rgb(226 232 240 / 0.9);
}

[hidden] {
  display: none !important;
}

body {
  font-family: Inter, system-ui, sans-serif;
}

/* —— Login —— */
#view-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgb(99 102 241 / 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgb(168 85 247 / 0.14), transparent 50%),
    linear-gradient(165deg, #f8fafc 0%, #eef2ff 40%, #f1f5f9 100%);
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(12px);
  border-radius: var(--hub-radius-lg);
  border: 1px solid rgb(255 255 255 / 0.8);
  box-shadow: 0 24px 48px rgb(15 23 42 / 0.08), 0 0 0 1px rgb(99 102 241 / 0.06);
  padding: 2.25rem 2.25rem 2rem;
}

.login-brand-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.login-brand-ico {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--hub-accent) 0%, var(--hub-accent-2) 100%);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 24px rgb(79 70 229 / 0.35);
}

.login-brand-ico [data-lucide] {
  width: 28px;
  height: 28px;
  stroke-width: 2px;
}

.login-card h1 {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 0.25rem;
}

.login-card .lead {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.55;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.field label [data-lucide] {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

#auth-error {
  display: none;
  font-size: 0.8125rem;
  color: #991b1b;
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 1rem;
  line-height: 1.45;
}

#auth-error.auth-success {
  color: #065f46;
  background: var(--ok-soft);
  border-color: #a7f3d0;
}

.btn-login-wrap {
  position: relative;
  margin-top: 0.25rem;
  border-radius: 11px;
  padding: 2px;
  background: linear-gradient(120deg, #6366f1, #8b5cf6, #3b82f6, #6366f1);
  background-size: 240% 240%;
  animation: flare-shift 5s ease infinite;
}

.btn-login-wrap:has(.btn-login:disabled) {
  animation: none;
  opacity: 0.75;
}

@keyframes flare-shift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.btn-login {
  width: 100%;
  border: none;
  border-radius: 9px;
  padding: 0.7rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(180deg, #5b52ee 0%, var(--accent) 100%);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-login .shine {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgb(255 255 255 / 0.22) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.55s ease;
}

.btn-login:hover:not(:disabled) .shine {
  transform: translateX(100%);
}

.btn-login [data-lucide] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tiny-row {
  margin-top: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
}

.tiny-row .tiny-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.6875rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tiny-row .tiny-link .ui-spinner {
  margin-right: 0;
}

.tiny-row .tiny-link:hover {
  color: var(--accent);
}

/* —— Hub shell —— */
.hub-top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 24px rgb(15 23 42 / 0.04);
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.03em;
  flex-wrap: wrap;
}

.hub-brand-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--hub-accent), var(--hub-accent-2));
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgb(79 70 229 / 0.3);
}

.hub-brand-ico [data-lucide] {
  width: 18px;
  height: 18px;
}

.hub-version {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--mono);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.hub-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.hub-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.hub-nav-link [data-lucide] {
  width: 16px;
  height: 16px;
}

.hub-nav-link:hover {
  background: rgb(99 102 241 / 0.08);
  border-color: rgb(99 102 241 / 0.15);
  color: var(--hub-accent);
}

.hub-nav-link--promo {
  background: linear-gradient(135deg, rgb(79 70 229 / 0.12), rgb(124 58 237 / 0.1));
  border-color: rgb(99 102 241 / 0.25);
  color: var(--hub-accent);
  font-size: 0.9375rem;
  padding: 0.6rem 1.1rem;
}

.hub-nav-link--promo:hover {
  background: linear-gradient(135deg, rgb(79 70 229 / 0.2), rgb(124 58 237 / 0.16));
}

@media (max-width: 900px) {
  .hub-top {
    flex-wrap: wrap;
  }
  .hub-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    padding-top: 0.25rem;
    border-top: 1px solid var(--glass-border);
  }
}

.hub-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

#view-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 50% at 0% 0%, rgb(99 102 241 / 0.07), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 20%, rgb(168 85 247 / 0.06), transparent 45%),
    #f1f5f9;
}

.hub-main {
  flex: 1;
  padding: 1.5rem 1.5rem 3rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* —— Bento hero (2026) —— */
.hub-hero-bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 900px) {
  .hub-hero-bento {
    grid-template-columns: 1.4fr 1fr;
    grid-template-rows: auto auto;
  }

  .hub-hero-main {
    grid-row: span 2;
  }
}

.hub-hero-main,
.hub-hero-search-card,
.hub-hero-recent {
  padding: 1.35rem 1.5rem;
  border-radius: var(--hub-radius-lg);
  background: linear-gradient(135deg, #fff 0%, #f8fafc 55%, #eef2ff 100%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgb(15 23 42 / 0.06);
}

.hub-hero-main h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.hub-hero-main h1 [data-lucide] {
  width: 28px;
  height: 28px;
  color: var(--hub-accent);
}

.hub-hero-lead {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--muted);
  max-width: 36rem;
  line-height: 1.55;
}

.hub-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.hub-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  box-shadow: 0 2px 8px rgb(15 23 42 / 0.04);
}

.hub-stat [data-lucide] {
  width: 16px;
  height: 16px;
  color: var(--hub-accent);
}

.hub-hero-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.hub-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 8px rgb(15 23 42 / 0.04);
  transition: background 0.15s, border-color 0.15s;
}

.hub-quick-link:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.hub-quick-link.primary {
  background: var(--hub-accent, #4f46e5);
  color: #fff;
  border-color: transparent;
}

.hub-quick-link.primary:hover {
  filter: brightness(1.05);
}

.hub-quick-link [data-lucide] {
  width: 16px;
  height: 16px;
}

.hub-search-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.hub-search-label [data-lucide] {
  width: 14px;
  height: 14px;
}

.hub-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.hub-search-wrap:focus-within {
  border-color: var(--hub-accent);
  box-shadow: 0 0 0 3px rgb(79 70 229 / 0.12);
}

.hub-search-wrap [data-lucide] {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.hub-search-wrap input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  min-width: 0;
}

.hub-search-wrap input:focus {
  outline: none;
  box-shadow: none;
}

.hub-recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.hub-recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.hub-recent-chip:hover {
  border-color: var(--hub-accent);
  color: var(--hub-accent);
}

.hub-recent-chip [data-lucide] {
  width: 14px;
  height: 14px;
}

.hub-recent-empty {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.tool-tile.is-hidden-by-search {
  display: none !important;
}

.tool-category.is-hidden-by-search {
  display: none !important;
}

/* —— Categories & tiles —— */
.hub-categories {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 1.1rem;
}

@media (min-width: 900px) {
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tool-category[data-category='bilder-erstellen'] {
  --cat: #7c3aed;
  --cat-soft: #ede9fe;
}
.tool-category[data-category='bild-medien'] {
  --cat: #0284c7;
  --cat-soft: #e0f2fe;
}
.tool-category[data-category='text-research'] {
  --cat: #d97706;
  --cat-soft: #fef3c7;
}
.tool-category[data-category='email'] {
  --cat: #e11d48;
  --cat-soft: #ffe4e6;
}
.tool-category[data-category='web-extraktion'] {
  --cat: #059669;
  --cat-soft: #d1fae5;
}
.tool-category[data-category='daten'] {
  --cat: #475569;
  --cat-soft: #f1f5f9;
}
.tool-category[data-category='planung'] {
  --cat: #4f46e5;
  --cat-soft: #e0e7ff;
}

.tool-category {
  border: 1px solid rgb(226 232 240 / 0.95);
  border-radius: var(--hub-radius-lg);
  background: #fff;
  box-shadow: 0 8px 32px rgb(15 23 42 / 0.05);
  overflow: hidden;
}

.tool-category-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border: none;
  background: linear-gradient(90deg, var(--cat-soft) 0%, #fff 65%);
  cursor: pointer;
  font: inherit;
  color: var(--text);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.tool-category-head:hover {
  filter: brightness(0.98);
}

.tool-category-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.tool-category-ico {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--cat);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.12);
}

.tool-category-ico [data-lucide] {
  width: 24px;
  height: 24px;
  stroke-width: 2px;
}

.tool-category-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.tool-category-title {
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
}

.tool-category-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tool-category-sub [data-lucide] {
  width: 13px;
  height: 13px;
}

.tool-category-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.tool-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--cat);
}

.tool-category-pill [data-lucide] {
  width: 12px;
  height: 12px;
}

.tool-category-chevron {
  color: var(--muted);
  width: 20px;
  height: 20px;
  transition: transform 0.22s ease;
}

.tool-category.collapsed .tool-category-chevron {
  transform: rotate(-90deg);
}

.tool-category.collapsed .tool-category-panel {
  display: none;
}

.tool-category-panel {
  padding: 1.25rem;
  background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
}

.tool-tile {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--hub-radius);
  padding: 1.2rem 1.25rem 1.1rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  overflow: hidden;
}

.tool-tile-glow {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cat-soft, #eef2ff) 0%, transparent 70%);
  opacity: 0.9;
  pointer-events: none;
}

.tool-category .tool-tile .tool-tile-glow {
  background: radial-gradient(circle, var(--cat-soft) 0%, transparent 72%);
}

.tool-category .tool-tile .tool-ico {
  color: var(--cat);
}

.tool-tile:hover {
  transform: translateY(-3px);
  border-color: rgb(99 102 241 / 0.35);
  box-shadow: 0 16px 40px rgb(15 23 42 / 0.1);
}

.tool-tile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.tool-ico {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--cat-soft, #f3f4f6), #fff);
  border: 1px solid rgb(226 232 240 / 0.8);
  display: grid;
  place-items: center;
  color: var(--cat, var(--hub-accent));
  flex-shrink: 0;
}

.tool-ico [data-lucide] {
  width: 26px;
  height: 26px;
  stroke-width: 1.75px;
}

.tool-tile-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--muted);
}

.tool-tile-badge [data-lucide] {
  width: 14px;
  height: 14px;
}

.tool-tile h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.tool-tile .desc {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.tool-tile .desc code {
  font-size: 0.7rem;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  word-break: break-all;
  white-space: pre-wrap;
  max-width: 100%;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tool-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
}

.tool-tag [data-lucide] {
  width: 10px;
  height: 10px;
  opacity: 0.7;
}

.tool-tile .act {
  margin-top: auto;
  padding-top: 0.35rem;
}

.tool-tile .tile-btn {
  width: 100%;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 11px;
}

.tile-btn [data-lucide] {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* —— Dialogs —— */
.setup-api pre.out {
  display: none;
  margin: 0.35rem 0 0;
  font-size: 0.65rem;
  font-family: var(--mono);
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #374151;
}

.setup-api pre.out.show {
  display: block;
}

.setup-api pre.out.ok {
  background: var(--ok-soft);
  border-color: #a7f3d0;
  color: #065f46;
}

.setup-api pre.out.bad {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: #991b1b;
}

.setup-api {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.setup-api h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hub-dialog-wrap {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / 0.35);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.hub-dialog-wrap.show {
  display: flex;
}

.hub-dialog {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 100%;
  padding: 1.25rem;
  max-height: 90vh;
  overflow-y: auto;
}

.hub-dialog.wide {
  max-width: 520px;
}

.hub-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hub-dialog .hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 1rem;
  line-height: 1.4;
}

.hub-dialog label {
  font-size: 0.75rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
}

.hub-dialog input[type='password'],
.hub-dialog input[type='text'] {
  width: 100%;
  margin-bottom: 1rem;
}

.hub-dialog select.hub-pref-select {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: inherit;
  background: var(--card);
}

.hub-prefs-provider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 1rem;
  margin: 0.35rem 0 1rem;
}

.hub-pref-provider-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  margin: 0;
}

.hub-pref-provider-row input {
  margin: 0;
}

.hub-dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.hub-user-line {
  font-size: 0.8125rem;
  color: var(--text);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.hub-user-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(100%, 280px);
  white-space: nowrap;
}

.hub-debug-panel {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: min(920px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hub-debug-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.hub-debug-head h2 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hub-debug-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hub-debug-textarea {
  flex: 1;
  min-height: 260px;
  max-height: min(58vh, 520px);
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0.75rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  resize: none;
  background: #fafafa;
  color: #111;
}

/* —— Dark mode —— */
html.hub-dark {
  color-scheme: dark;
}

html.hub-dark {
  --page-bg: #0f1117;
  --card: #171b25;
  --border: #2a3142;
  --text: #e9edf5;
  --muted: #94a3b8;
  --surface: #12151c;
  --elevated: #1a1f2b;
  --glass: rgb(23 27 37 / 0.9);
  --glass-border: rgb(42 49 66 / 0.95);
}

html.hub-dark #view-login {
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgb(79 70 229 / 0.2), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgb(124 58 237 / 0.15), transparent 50%),
    linear-gradient(165deg, #0f1117 0%, #151a28 40%, #0f1117 100%);
}

html.hub-dark .login-card,
html.hub-dark .hub-hero-main,
html.hub-dark .hub-hero-search-card,
html.hub-dark .hub-hero-recent,
html.hub-dark .tool-category,
html.hub-dark .tool-tile,
html.hub-dark .hub-stat,
html.hub-dark .hub-search-wrap,
html.hub-dark .hub-recent-chip,
html.hub-dark .hub-nav-link {
  color: var(--text);
}

html.hub-dark .hub-nav-link:hover {
  background: rgb(99 102 241 / 0.15);
  color: #a5b4fc;
}

html.hub-dark .hub-nav-link--promo {
  background: rgb(99 102 241 / 0.18);
  border-color: rgb(129 140 248 / 0.35);
  color: #a5b4fc;
}

html.hub-dark .hub-quick-link {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

html.hub-dark .hub-hero-main,
html.hub-dark .hub-hero-search-card,
html.hub-dark .hub-hero-recent {
  background: linear-gradient(135deg, #171b25 0%, #1a1f2b 55%, #1e2433 100%);
}

html.hub-dark #view-app {
  background:
    radial-gradient(ellipse 90% 50% at 0% 0%, rgb(79 70 229 / 0.1), transparent 50%),
    #0f1117;
}

html.hub-dark .tool-category-head {
  background: linear-gradient(90deg, rgb(79 70 229 / 0.12) 0%, var(--card) 65%);
}

html.hub-dark .tool-category-panel {
  background: linear-gradient(180deg, #141820 0%, #12151c 100%);
}

html.hub-dark .hub-debug-textarea {
  background: #0f1117;
  color: #e2e8f0;
}

html.hub-dark .hub-version {
  background: var(--elevated);
}

/* —— Responsive —— */
@media (max-width: 640px) {
  #view-login {
    padding: 1.25rem 1rem;
  }

  .login-card {
    padding: 1.5rem 1.25rem;
  }

  .hub-main,
  .hub-hero-main,
  .hub-hero-search-card,
  .hub-hero-recent,
  .tool-category-panel {
    padding-inline: 1rem;
  }

  .hub-hero-main {
    padding: 1.25rem 1rem;
  }

  .hub-hero-main h1 {
    font-size: 1.35rem;
  }

  .hub-top {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .hub-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .tool-category-head {
    flex-wrap: wrap;
    padding: 0.9rem 1rem;
  }

  .tool-category-pill {
    display: none;
  }

  .tool-tile {
    min-height: 0;
    padding: 1.15rem 1.1rem;
  }

  .tiny-row .tiny-link {
    min-height: 44px;
    padding: 0.5rem 0.65rem;
    font-size: 0.8125rem;
  }

  .hub-pref-provider-row {
    min-height: 44px;
    padding: 0.35rem 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hub-prefs-provider-grid {
    grid-template-columns: 1fr;
  }

  .tool-category-sub {
    font-size: 0.6875rem;
  }

  .hub-dialog-wrap {
    padding: 0.75rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .hub-top {
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-login-wrap {
    animation: none;
  }

  .tool-tile:hover {
    transform: none;
  }
}
