@import url("./aha-tokens.css");

:root {
  --aha-bg: var(--aha-color-bg, #07080d);
  --aha-surface: var(--aha-color-surface, #11131b);
  --aha-card: var(--aha-color-panel, rgba(18,20,29,.96));
  --aha-card-soft: var(--aha-color-panel-soft, rgba(29,32,43,.82));
  --aha-line: var(--aha-color-line, rgba(151,181,220,.22));
  --aha-line-yellow: rgba(244,200,74,.42);
  --aha-yellow: var(--aha-color-accent, #f4c84a);
  --aha-yellow-soft: var(--aha-color-accent-soft, rgba(244,200,74,.15));
  --aha-text: var(--aha-color-text, #f8fbff);
  --aha-muted: var(--aha-color-muted, #aebed2);
  --aha-green: var(--aha-color-green, #7ee2a8);
  --aha-shadow: 0 24px 64px rgba(1,7,15,.34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--aha-app-background);
  color: var(--aha-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--aha-grid-line) 1px, transparent 1px), linear-gradient(var(--aha-grid-line) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 72%);
}

.aha-dashboard {
  position: relative;
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 24px 20px 96px;
}

.aha-app-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--aha-line);
  border-radius: 24px;
  background: var(--aha-color-glass);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 42px rgba(0,0,0,.18);
}

.aha-brand,
.aha-header-actions,
.aha-profile-body,
.aha-profile-name-row,
.aha-auth-inline,
.aha-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.aha-brand {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.aha-brand-mark,
.aha-profile-avatar {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #fff6b5, var(--aha-yellow) 45%, #9b7800);
  color: #12100a;
  font-weight: 950;
  box-shadow: 0 0 0 3px rgba(246,200,0,.14), 0 18px 44px rgba(246,200,0,.14);
}

.aha-brand-mark { width: 46px; height: 46px; font-size: 1.25rem; }
.aha-profile-avatar { width: 112px; height: 112px; font-size: 2.2rem; flex: 0 0 auto; }

.aha-brand strong,
.aha-brand small,
.aha-mini-stat strong,
.aha-mini-stat span,
.aha-stat strong,
.aha-stat span { display: block; }

.aha-brand small,
.aha-profile-copy p,
.aha-section-heading p,
.aha-side-card p,
.aha-profile-name-form p,
.aha-auth-output,
.aha-status-updated { color: var(--aha-muted); }

.aha-header-actions {
  justify-content: flex-end;
  min-width: 0;
}

.aha-ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--aha-control-min-height);
  border: 1px solid rgba(116,173,255,.28);
  border-radius: var(--aha-radius-control);
  background: var(--aha-color-blue-soft);
  color: var(--aha-text);
  padding: var(--aha-control-padding-y) var(--aha-control-padding-x);
  font-weight: 850;
}

button {
  min-height: var(--aha-control-min-height);
  border: 0;
  border-radius: var(--aha-radius-control);
  background: var(--aha-yellow);
  color: #12100a;
  padding: var(--aha-control-padding-y) var(--aha-control-padding-x);
  font: inherit;
  font-weight: 920;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .68;
}

button:hover { filter: brightness(1.07); }

.aha-google-button {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  background: #ffffff;
  color: #171717;
  border: 1px solid rgba(255,255,255,.18);
}

.aha-google-button::before {
  content: "G";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  background: #f1f1f1;
  color: #111;
  font-weight: 950;
}

.aha-auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 2px;
  color: var(--aha-muted);
  font-size: .86rem;
  font-weight: 800;
}

.aha-auth-divider::before,
.aha-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.13);
}

.aha-status-pill,
.aha-profile-auth-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: var(--aha-muted);
  font-size: .78rem;
  font-weight: 850;
  white-space: nowrap;
}

.aha-status-pill::before,
.aha-profile-auth-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(247,243,223,.46);
}

.aha-status-pill.is-signed-in,
.aha-profile-auth-state.is-signed-in { background: rgba(135,247,174,.12); color: var(--aha-green); }
.aha-status-pill.is-signed-in::before,
.aha-profile-auth-state.is-signed-in::before { background: var(--aha-green); }
.aha-status-pill.is-missing-profile,
.aha-profile-auth-state.is-missing-profile { background: var(--aha-yellow-soft); color: #ffe27a; }
.aha-status-pill.is-missing-profile::before,
.aha-profile-auth-state.is-missing-profile::before { background: var(--aha-yellow); }

.aha-auth-inline.is-hidden,
.aha-ghost-button.is-hidden,
.aha-side-card.is-hidden,
.aha-login-card.is-hidden,
.aha-profile-name-form.is-hidden { display: none !important; }

.aha-hero-profile {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, .72fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 34px;
}

.aha-profile-main-card,
.aha-side-card,
.aha-panel,
.aha-tile {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--aha-line);
  border-radius: 32px;
  background: var(--aha-panel-background);
  box-shadow: var(--aha-shadow);
}

.aha-profile-main-card {
  min-height: 440px;
  padding: clamp(22px, 4vw, 36px);
}

.aha-profile-main-card::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(116,173,255,.15), transparent 65%);
  pointer-events: none;
}

.aha-profile-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 34px;
  position: relative;
  z-index: 1;
}

.aha-profile-label {
  color: var(--aha-muted);
  font-size: .92rem;
  font-weight: 800;
}

.aha-profile-body {
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--aha-muted);
  font-size: .78rem;
  font-weight: 950;
}

.aha-profile-copy h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(2.4rem, 7vw, 5.8rem);
  line-height: .9;
  letter-spacing: -.075em;
}

.aha-profile-copy p {
  max-width: 560px;
  margin: 16px 0 0;
  line-height: 1.5;
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.aha-profile-id-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  background: rgba(255,255,255,.065);
  color: var(--aha-muted);
}

.aha-profile-id-row strong { color: var(--aha-text); }

.aha-profile-name-form {
  position: relative;
  z-index: 2;
  margin-top: 26px;
  padding: 16px;
  border: 1px solid var(--aha-line);
  border-radius: 22px;
  background: var(--aha-card-soft);
}

.aha-profile-name-form label { display: block; margin-bottom: 9px; font-weight: 900; }
.aha-profile-name-form p, .aha-auth-output { margin: 10px 0 0; }

input {
  width: 100%;
  min-height: var(--aha-field-min-height);
  border: 1px solid var(--aha-line);
  border-radius: var(--aha-radius-control);
  background: var(--aha-color-input);
  color: var(--aha-text);
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

input:focus { border-color: var(--aha-color-blue); box-shadow: var(--aha-focus-ring); }
.aha-profile-name-row input { flex: 1; }

.aha-profile-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 10px;
  margin-top: 34px;
}

.aha-mini-stat,
.aha-stat {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 18px;
  background: var(--aha-color-panel-soft);
}

.aha-mini-stat strong,
.aha-stat strong { color: var(--aha-text); font-size: 1.12rem; }
.aha-mini-stat span,
.aha-stat span { margin-top: 5px; color: var(--aha-muted); font-size: .84rem; }

.aha-side-card {
  align-self: stretch;
  padding: 22px;
  background: var(--aha-panel-background-soft);
}

.aha-side-card h2 {
  margin: 0 0 10px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  letter-spacing: -.04em;
}

.aha-side-card p { line-height: 1.48; }
.aha-auth-inline { flex-direction: column; align-items: stretch; margin-top: 16px; }

.aha-section-heading {
  margin: 0 0 18px;
  max-width: 720px;
}

.aha-section-heading h2,
.aha-panel h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  letter-spacing: -.04em;
}

.aha-section-heading p { margin: 8px 0 0; line-height: 1.45; }

.aha-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 16px;
  margin-bottom: 34px;
}

.aha-tile {
  min-height: 176px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  color: inherit;
  text-decoration: none;
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.aha-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(116,173,255,.34);
  background: linear-gradient(145deg, rgba(116,173,255,.12), rgba(170,145,247,.07));
}

.aha-tile-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--aha-color-blue-soft);
  color: var(--aha-color-blue);
  font-weight: 950;
  font-size: 1.25rem;
}

.aha-tile strong { font-size: 1.18rem; }
.aha-tile-priority {
  border-color: rgba(170,145,247,.32);
  background: linear-gradient(145deg, rgba(170,145,247,.13), rgba(116,173,255,.07));
}
.aha-tile-priority strong { font-size: 1.28rem; }
.aha-tile span:not(.aha-tile-icon) { color: var(--aha-muted); line-height: 1.35; }
.aha-tile small { margin-top: auto; width: fit-content; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--aha-text); font-weight: 800; }
.aha-button-tile { font: inherit; }
.aha-home-tile { cursor: pointer; }
.aha-tile-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.aha-tile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: var(--aha-radius-control);
  padding: 8px 12px;
  font-weight: 800;
  font-size: .88rem;
  text-decoration: none;
  border: 1px solid transparent;
}
.aha-tile-btn-primary {
  background: var(--aha-color-blue-soft);
  border-color: rgba(116,173,255,.42);
  color: #d8e8ff;
}
.aha-tile-btn-secondary {
  background: rgba(88,217,199,.07);
  border-color: rgba(88,217,199,.2);
  color: var(--aha-text);
  cursor: pointer;
}
.aha-tile-btn-primary:hover,
.aha-tile-btn-secondary:hover { filter: brightness(1.08); }

.aha-panel { padding: 20px; }
.aha-action-panel,
.aha-historygo-panel,
.aha-insights-panel {
  margin-bottom: 20px;
  border-radius: 30px;
}
.aha-action-buttons {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.aha-cta-primary,
.aha-cta-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--aha-radius-control);
  padding: 10px 14px;
  font-weight: 900;
  text-decoration: none;
}
.aha-cta-primary {
  background: var(--aha-yellow);
  color: #12100a;
}
.aha-cta-secondary-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.aha-cta-secondary {
  border: 1px solid rgba(116,173,255,.28);
  background: var(--aha-color-blue-soft);
  color: var(--aha-text);
}
.aha-profile-connection {
  margin-top: 10px;
  font-size: .95rem;
  color: var(--aha-muted);
}
.aha-profile-link { margin-top: 14px; width: fit-content; }
.aha-insights-panel small {
  display: block;
  margin-top: 8px;
  color: var(--aha-muted);
}
.aha-mobile-nav {
  display: none;
}
.aha-panel-head { justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.aha-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px,1fr)); gap: 10px; }
.aha-stat-source { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.07); }
.aha-dashboard-output { max-height: 260px; overflow: auto; margin: 14px 0 0; padding: 14px; border-radius: 18px; background: rgba(0,0,0,.22); color: var(--aha-muted); white-space: pre-wrap; }

@media (max-width: 940px) {
  .aha-app-header,
  .aha-hero-profile { grid-template-columns: 1fr; }
  .aha-header-actions { justify-content: flex-start; }
  .aha-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .aha-profile-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .aha-cta-secondary-row { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .aha-dashboard { padding: 14px; }
  .aha-profile-main-card,
  .aha-side-card,
  .aha-panel,
  .aha-tile,
  .aha-app-header { border-radius: 22px; }
  .aha-profile-body { flex-direction: column; align-items: flex-start; }
  .aha-profile-avatar { width: 82px; height: 82px; }
  .aha-grid,
  .aha-profile-stats { grid-template-columns: 1fr; }
  .aha-tile { min-height: 150px; }
  .aha-mobile-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--aha-line);
    border-radius: 18px;
    background: rgba(5,6,9,.96);
    backdrop-filter: blur(8px);
  }
  .aha-mobile-nav a {
    text-decoration: none;
    color: var(--aha-text);
    font-size: .82rem;
    text-align: center;
    padding: 8px 6px;
    border-radius: 12px;
  }
  .aha-mobile-nav a[aria-current="page"] {
    background: rgba(255,255,255,.12);
    color: var(--aha-text);
  }
}

.aha-profile-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.aha-status-card {
  border: 1px solid var(--aha-line);
  border-radius: 14px;
  padding: 10px;
  background: var(--aha-card-soft);
}

.aha-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.aha-activity-list li {
  border: 1px solid var(--aha-line);
  border-radius: 12px;
  padding: 10px;
  background: var(--aha-card-soft);
  display: grid;
  gap: 4px;
}

.aha-activity-list small,
.aha-status-stack { color: var(--aha-muted); }

.aha-afterwork-archive {
  border: 1px solid var(--aha-line);
  background: linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}

.aha-afterwork-list {
  display: grid;
  gap: 10px;
}

.aha-afterwork-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--aha-line);
  background: rgba(18,20,29,.88);
}

.aha-afterwork-card p {
  margin: 0;
  color: var(--aha-text);
}

.aha-afterwork-meta {
  color: var(--aha-muted);
  font-size: .8rem;
}

.aha-afterwork-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.aha-afterwork-chips span {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: var(--aha-text);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: .76rem;
  font-weight: 700;
}

.aha-afterwork-empty {
  margin: 0;
  color: var(--aha-muted);
}

.aha-historygo-status,
.aha-privacy-status { margin-top: 10px; }

.aha-sync-hub-status { margin-top: 10px; }
.aha-sync-hub-status .aha-status-card { display: grid; gap: 10px; }
.aha-sync-hub-status h3,
.aha-sync-hub-status p { margin: 0; }

.aha-status-stack {
  display: grid;
  gap: 6px;
}

.aha-historygo-payload-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.aha-historygo-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.aha-historygo-event-list li {
  border: 1px solid var(--aha-line);
  border-radius: 12px;
  padding: 10px;
  background: var(--aha-card-soft);
  display: grid;
  gap: 4px;
}

.aha-historygo-event-list p,
.aha-historygo-event-list small {
  margin: 0;
  color: var(--aha-muted);
}

.gruppe-select { min-width: 180px; }
.gruppe-knapp { white-space: nowrap; }
.statuslinje { font-size: 0.9rem; opacity: 0.85; margin-top: 4px; }


/* App-layout refactor */
html, body { max-width: 100%; }
.aha-dashboard { width: min(760px, 100%); max-width: 100%; padding: 10px 10px 104px; }
.aha-app-header { padding: 10px 14px; border-radius: 18px; margin-bottom: 14px; }
.aha-brand-mark { width: 38px; height: 38px; font-size: 1rem; }

.aha-profile-strip {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(260px,340px);
  gap: 14px;
  margin-bottom: 14px;
}
.aha-profile-main-card { min-height: 0; padding: 16px 18px; border-radius: var(--aha-radius-panel); }
.aha-profile-main-card::after { display: none; }
.aha-profile-topline { margin-bottom: 14px; }
.aha-profile-body { align-items: flex-start; gap: 14px; }
.aha-profile-avatar { width: 64px; height: 64px; font-size: 1.4rem; }
.aha-profile-copy h1 { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.06; letter-spacing: -.02em; }
.aha-profile-copy p { margin-top: 8px; font-size: .95rem; max-width: none; }
.aha-profile-id-row { margin-top: 10px; padding: 6px 10px; font-size: .82rem; }
.aha-profile-quick-actions { margin-left: auto; display: grid; gap: 8px; min-width: 210px; }
.aha-profile-quick-actions .aha-cta-primary,
.aha-profile-quick-actions .aha-cta-secondary { min-height: 40px; padding: 8px 12px; }

.aha-side-card { border-radius: var(--aha-radius-panel); padding: 16px; }
.aha-side-card h2 { font-size: 1.25rem; }

.aha-app-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.aha-panel { border-radius: var(--aha-radius-panel); padding: 16px; }
.aha-home-panel, .aha-modules-panel, .aha-status-panel { overflow: visible; }

.aha-modules-panel h2, .aha-home-panel h1, .aha-status-panel h2 { font-size: 1.2rem; }
.aha-modules-panel .aha-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 0; }
.aha-tile { min-height: 0; padding: 12px; border-radius: var(--aha-radius-card); gap: 6px; }
.aha-tile strong { font-size: .98rem; }
.aha-tile span:not(.aha-tile-icon) { font-size: .82rem; }
.aha-tile-icon { width: 30px; height: 30px; font-size: .95rem; border-radius: 10px; }
.aha-tile small { padding: 4px 8px; font-size: .75rem; }

.aha-panel-subtitle { margin: 0; color: var(--aha-muted); font-size: .88rem; }
.aha-action-buttons { margin-top: 12px; }
.aha-cta-primary, .aha-cta-secondary { min-height: 42px; }
.aha-cta-secondary-row { grid-template-columns: repeat(3, minmax(0,1fr)); }
.aha-profile-stats { grid-template-columns: repeat(3, minmax(0,1fr)); margin-top: 12px; }
.aha-mini-stat { padding: 10px; border-radius: 14px; }
.aha-mini-stat strong { font-size: 1rem; }

.aha-next-panel, .aha-activity-panel { margin-top: 12px; border-radius: 16px; background: rgba(255,255,255,.03); }
.aha-next-panel h3, .aha-activity-panel h3 { margin: 0 0 8px; font-size: 1rem; }
.aha-tech-status { margin-top: 10px; }
.aha-tech-status summary { cursor: pointer; color: var(--aha-muted); font-weight: 700; }
.aha-dashboard-output { margin-top: 8px; max-height: 150px; }
.aha-system-panel {
  background: rgba(170,145,247,.045);
  box-shadow: none;
  border-color: rgba(170,145,247,.14);
}
.aha-system-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--aha-muted);
}
.aha-system-panel > summary strong { color: var(--aha-text); font-size: 1.05rem; }
.aha-system-panel > summary .eyebrow { display: block; margin-bottom: 4px; }
.aha-system-panel-content { display: grid; gap: 14px; margin-top: 16px; }
.aha-system-panel .aha-product-integration-panel,
.aha-system-panel .aha-product-flow-panel,
.aha-system-panel .aha-status-panel {
  background: rgba(116,173,255,.045);
  box-shadow: none;
}

@media (max-width: 1080px) {
  .aha-status-panel { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .aha-profile-strip { grid-template-columns: 1fr; }
  .aha-profile-body {
    flex-direction: column;
    align-items: stretch;
  }
  .aha-profile-copy { min-width: 0; }
  .aha-profile-avatar { align-self: flex-start; }
  .aha-profile-quick-actions { margin-left: 0; min-width: 0; width: 100%; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .aha-home-panel, .aha-modules-panel, .aha-status-panel { overflow: visible; }
  .aha-modules-panel .aha-grid { display: grid; grid-template-columns: 1fr; gap: 8px; padding-bottom: 0; }
  .aha-modules-panel .aha-grid > * { min-width: 0; }
}
@media (max-width: 620px) {
  .aha-dashboard { padding: 12px 12px 120px; }
  .aha-profile-quick-actions { grid-template-columns: 1fr; }
  .aha-cta-secondary-row { grid-template-columns: 1fr; }
  .aha-profile-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .aha-mobile-nav { bottom: 10px; }
}

/* Compact app-header + modal-only login */
.aha-app-header {
  position: sticky;
  top: 8px;
  z-index: 25;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  min-height: 60px;
  max-height: 72px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 16px;
}

.aha-brand { gap: 8px; }
.aha-brand-mark { width: 34px; height: 34px; font-size: .92rem; }
.aha-brand strong { font-size: .98rem; line-height: 1; }
.aha-brand small { font-size: .72rem; line-height: 1.1; }

.aha-header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}
.aha-status-pill,
.aha-profile-auth-state { font-size: .72rem; padding: 3px 8px; }

.aha-header-profile {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.aha-header-profile .aha-profile-avatar {
  width: 32px;
  height: 32px;
  font-size: .8rem;
  box-shadow: none;
  flex: 0 0 32px;
}
.aha-header-profile .aha-profile-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}
.aha-header-profile #aha-profile-name {
  display: block;
  font-size: .92rem;
  line-height: 1.1;
}
.aha-header-profile #aha-profile-subtitle,
.aha-header-profile #aha-profile-connection {
  margin: 0;
  font-size: .7rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aha-header-profile .aha-profile-id-row {
  margin: 0;
  margin-top: 2px;
  padding: 3px 7px;
  font-size: .7rem;
  gap: 6px;
  max-width: fit-content;
}

.aha-header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.aha-header-actions .aha-cta-primary,
.aha-header-actions .aha-cta-secondary,
.aha-header-actions .aha-ghost-button {
  min-height: 36px;
  padding: 7px 10px;
  font-size: .83rem;
  white-space: nowrap;
}

.aha-profile-name-form {
  margin-top: 14px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--aha-line);
  background: var(--aha-card-soft);
}
.aha-profile-name-form label { margin-bottom: 6px; font-size: .8rem; }

.aha-login-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px 12px;
}
.aha-login-modal.is-hidden { display: none !important; }
.aha-login-modal:not(.is-hidden) { display: grid; }
.aha-login-modal-backdrop { position: absolute; inset: 0; background: rgba(3,4,8,.72); }
.aha-login-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  border-radius: 22px;
}
.aha-login-close { margin-left: auto; margin-bottom: 10px; display: flex; }
.aha-profile-name-modal {
  position: fixed;
  inset: 0;
  z-index: 125;
  display: grid;
  place-items: center;
  padding: 16px 12px;
}
.aha-profile-name-modal.is-hidden { display: none !important; }
.aha-profile-name-modal:not(.is-hidden) { display: grid; }
.aha-profile-name-modal-backdrop { position: absolute; inset: 0; background: rgba(3,4,8,.72); }
.aha-profile-name-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  border-radius: 22px;
}

@media (max-width: 980px) {
  .aha-app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "meta profile";
    max-height: 96px;
    align-items: center;
  }
  .aha-brand { grid-area: brand; }
  .aha-header-actions { grid-area: actions; justify-content: flex-end; flex-wrap: wrap; }
  .aha-header-meta { grid-area: meta; min-width: 0; }
  .aha-header-profile { grid-area: profile; min-width: 0; justify-content: flex-end; }
  .aha-header-profile #aha-profile-subtitle,
  .aha-header-profile #aha-profile-connection { display: none; }
}

@media (max-width: 620px) {
  .aha-app-header { padding: 8px 10px; gap: 6px 8px; }
  .aha-header-profile #aha-profile-subtitle,
  .aha-header-profile #aha-profile-connection { display: none; }
  .aha-header-actions { justify-content: flex-start; }
  .aha-header-actions .aha-cta-primary,
  .aha-header-actions .aha-cta-secondary,
  .aha-header-actions .aha-ghost-button { min-height: 34px; font-size: .78rem; padding: 6px 9px; }
}

.aha-meta-profile-panel {
  border: 1px solid var(--aha-line);
  background: linear-gradient(145deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
}

.aha-meta-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.aha-meta-profile-section {
  border: 1px solid var(--aha-line);
  border-radius: 12px;
  background: rgba(8,10,16,.66);
  padding: 10px;
}

.aha-meta-profile-section h4 {
  margin: 0 0 8px;
  font-size: .86rem;
  color: var(--aha-text);
}

.aha-meta-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.aha-meta-chip {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: var(--aha-text);
  padding: 3px 8px;
  font-size: .78rem;
}

.aha-meta-chip-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.aha-meta-action {
  min-height: 28px;
  padding: 4px 10px;
  margin-top: 6px;
}

.aha-meta-line-list,
.aha-meta-mini-list {
  margin: 0;
  padding-left: 16px;
  color: var(--aha-muted);
  display: grid;
  gap: 5px;
}

.aha-meta-mini-list li small {
  color: var(--aha-muted);
}

.aha-meta-line-action {
  margin-left: 0;
}

.aha-meta-insight-section {
  grid-column: 1 / -1;
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.05);
}

.aha-meta-insight-summary {
  margin: 0 0 8px;
  color: var(--aha-text, #f3f4f8);
  font-size: .9rem;
  line-height: 1.45;
}

.aha-meta-insight-row {
  margin: 6px 0 0;
  color: var(--aha-muted);
  font-size: .82rem;
  display: grid;
  gap: 4px;
}

.aha-meta-insight-row strong {
  color: var(--aha-text);
}

@media (max-width: 620px) {
  .aha-meta-profile-grid {
    grid-template-columns: 1fr;
  }
}

.aha-sync-prep-toggle {
  width: fit-content;
  padding: 10px 14px;
  font-size: .88rem;
}

.aha-sync-prep-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--aha-line);
  border-radius: 18px;
  background: rgba(255,255,255,.055);
}

.aha-sync-prep-heading {
  display: grid;
  gap: 4px;
}

.aha-sync-prep-heading h4 {
  margin: 0;
  font-size: .95rem;
}

.aha-sync-prep-notice {
  color: var(--aha-muted);
  font-size: .88rem;
  font-weight: 800;
}

.aha-sync-prep-list {
  display: grid;
  gap: 8px;
}

.aha-sync-prep-row {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 14px;
  background: rgba(7,8,13,.34);
}

.aha-sync-prep-row span,
.aha-sync-prep-row small,
.aha-sync-prep-row p,
.aha-sync-prep-row ul {
  color: var(--aha-muted);
}

.aha-sync-prep-row p,
.aha-sync-prep-row ul {
  grid-column: 1 / -1;
  margin: 0;
  font-size: .82rem;
}

.aha-sync-prep-row ul {
  padding-left: 18px;
}

.aha-sync-prep-row small {
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 900;
}

.aha-sync-validation-summary {
  margin: 0;
  color: var(--aha-text);
  font-size: .86rem;
  font-weight: 900;
}

.aha-sync-validation-block {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.09);
}

.aha-sync-validation-block h5,
.aha-sync-validation-block p {
  margin: 0;
}

.aha-sync-validation-block h5 {
  font-size: .84rem;
}

.aha-sync-validation-status {
  font-size: .82rem;
  font-weight: 900;
}

.aha-sync-validation-status-valid,
.aha-sync-validation-status-passed { color: var(--aha-green); }
.aha-sync-validation-status-warnings,
.aha-sync-validation-status-skipped,
.aha-sync-validation-status-warning { color: #ffe27a; }
.aha-sync-validation-status-errors,
.aha-sync-validation-status-blocked { color: #ff9b9b; }

.aha-sync-validation-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.aha-sync-validation-columns strong {
  display: block;
  margin-bottom: 3px;
  font-size: .78rem;
}

.aha-sync-validation-empty {
  color: var(--aha-muted);
  font-size: .8rem;
}

.aha-sync-validation-list-errors li { color: #ffb3b3; }
.aha-sync-validation-list-warnings li { color: #ffe27a; }

@media (max-width: 620px) {
  .aha-sync-validation-columns {
    grid-template-columns: 1fr;
  }
}

.aha-sync-payload-preview {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.aha-sync-payload-row code {
  color: #f7f0c6;
  white-space: normal;
  word-break: break-word;
}

.aha-sync-payload-samples {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}


.aha-sync-target-preview {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.aha-sync-target-select-label {
  color: #fff;
  font-size: .82rem;
  font-weight: 900;
}

.aha-sync-target-select {
  width: min(100%, 360px);
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(7,8,13,.58);
  color: #fff;
  font-weight: 800;
}

.aha-sync-target-selected_preview small,
.aha-sync-target-future_only small { color: #ffe27a; }
.aha-sync-target-not_configured small { color: var(--aha-green); }
.aha-sync-target-unavailable small { color: #ff9b9b; }
.aha-sync-operator-checklist {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.aha-sync-unavailable-notice {
  color: #ffef9c;
  font-weight: 900;
}

.aha-sync-checklist-passed small { color: var(--aha-green); }
.aha-sync-checklist-warning small { color: #ffe27a; }
.aha-sync-checklist-blocked small { color: #ff9b9b; }

.aha-sync-manual-gate {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.aha-sync-manual-button {
  justify-self: start;
  padding: 9px 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: var(--aha-muted);
  font-weight: 900;
  cursor: not-allowed;
  opacity: .68;
}

.aha-sync-manual-reasons,
.aha-sync-manual-requirements {
  margin: 0;
  padding-left: 18px;
  color: var(--aha-muted);
  font-size: .82rem;
}

.aha-sync-manual-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.aha-sync-confirmation-preview-button,
.aha-sync-confirmation-close {
  justify-self: start;
  padding: 9px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.aha-sync-confirmation-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4,5,9,.72);
}

.aha-sync-confirmation-modal {
  width: min(760px, 100%);
  max-height: min(88vh, 840px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 20px;
  background: #11131d;
  box-shadow: 0 20px 70px rgba(0,0,0,.45);
}

.aha-sync-confirmation-header,
.aha-sync-confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.aha-sync-confirmation-header h4,
.aha-sync-confirmation-section h5,
.aha-sync-confirmation-section p {
  margin: 0;
}

.aha-sync-confirmation-section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
}

.aha-sync-confirmation-module-list {
  display: grid;
  gap: 8px;
}

.aha-sync-audit-preview {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.aha-sync-audit-preview code,
.aha-sync-audit-preview-summary code {
  color: #f7f0c6;
  white-space: normal;
  word-break: break-word;
}

.aha-sync-audit-chip-list,
.aha-sync-audit-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--aha-muted);
  font-size: .82rem;
}

.aha-sync-audit-chip-list span,
.aha-sync-audit-counts span {
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
}

.aha-sync-run-summary-preview {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.aha-sync-run-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.aha-sync-run-summary-grid p {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
  color: var(--aha-muted);
  font-size: .82rem;
}

.aha-sync-run-summary-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--aha-muted);
  font-size: .82rem;
}

.aha-sync-run-summary-chip-list span {
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
}

@media (max-width: 620px) {
  .aha-sync-run-summary-grid {
    grid-template-columns: 1fr;
  }
}

.aha-sync-history-panel {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(8, 15, 25, 0.46);
}

.aha-sync-history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.aha-sync-history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
}

.aha-sync-history-row > div,
.aha-sync-history-actions {
  display: grid;
  gap: 5px;
}

.aha-sync-history-row span,
.aha-sync-history-row small,
.aha-sync-history-empty { color: var(--aha-muted); }

.aha-sync-history-actions { justify-items: end; }

.aha-compact-state {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 8px 9px;
  border-radius: 9px;
  color: var(--aha-muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.76rem;
}
.aha-compact-state strong { color: var(--aha-text); }
.aha-compact-state-error {
  border: 1px solid rgba(255, 96, 96, 0.2);
  background: rgba(255, 96, 96, 0.06);
}

.aha-sync-retry-badge {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #dce8f5;
  background: rgba(255, 255, 255, 0.08);
}

.aha-sync-retry-eligible_preview { color: var(--aha-green); background: rgba(53, 211, 153, 0.12); }
.aha-sync-retry-blocked,
.aha-sync-retry-unknown { color: #ffb3b3; background: rgba(255, 96, 96, 0.12); }
.aha-sync-retry-not_eligible { color: #ffe27a; background: rgba(255, 226, 122, 0.1); }

.aha-sync-history-details-button {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.aha-sync-history-drawer,
.aha-sync-retry-preview {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(112, 180, 255, 0.22);
  border-radius: 12px;
  background: rgba(13, 25, 40, 0.9);
}

.aha-sync-history-drawer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.aha-sync-history-drawer h5,
.aha-sync-history-drawer p,
.aha-sync-retry-preview h5,
.aha-sync-retry-preview p { margin: 0; }

.aha-sync-history-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.aha-sync-history-details-grid > div {
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.aha-sync-history-details-grid dt { color: var(--aha-muted); font-size: 0.78rem; }
.aha-sync-history-details-grid dd { margin: 3px 0 0; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .aha-sync-history-row { align-items: stretch; flex-direction: column; }
  .aha-sync-history-actions { justify-items: start; }
  .aha-sync-history-details-grid { grid-template-columns: 1fr; }
}

/* Compact AHA Home status hierarchy */
.aha-status-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.aha-status-panel > .aha-panel-head { margin-bottom: 0; }
.aha-status-panel > .aha-stats {
  grid-template-columns: 1fr;
  gap: 8px;
}

.aha-compact-status-card,
.aha-sync-hub-compact-card {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}

.aha-compact-status-card-primary { border-color: rgba(255,255,255,.22); }

.aha-compact-status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.aha-compact-status-header h3,
.aha-compact-status-header p,
.aha-compact-status-note { margin: 0; }
.aha-compact-status-header h3 { font-size: .96rem; }
.aha-compact-status-primary { font-size: .86rem; line-height: 1.3; }
.aha-compact-status-note,
.aha-compact-empty { margin: 0; color: var(--aha-muted); font-size: .76rem; }

.aha-status-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}
.aha-status-badge-ready { color: var(--aha-green); background: rgba(53,211,153,.11); border-color: rgba(53,211,153,.24); }
.aha-status-badge-warning { color: #ffe27a; background: rgba(255,226,122,.09); border-color: rgba(255,226,122,.22); }
.aha-status-badge-blocked { color: #ffb3b3; background: rgba(255,96,96,.11); border-color: rgba(255,96,96,.24); }
.aha-status-badge-neutral { color: var(--aha-muted); background: rgba(255,255,255,.05); }

.aha-compact-meta {
  display: grid;
  gap: 4px;
  margin: 0;
}
.aha-compact-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: var(--aha-muted);
  font-size: .75rem;
  line-height: 1.25;
}
.aha-compact-meta dt { flex: 0 0 auto; }
.aha-compact-meta dd {
  margin: 0;
  color: var(--aha-text);
  text-align: right;
  overflow-wrap: anywhere;
}

.aha-sync-hub-status,
.aha-historygo-status,
.aha-privacy-status { margin-top: 0; }
.aha-sync-hub-status .aha-status-card { gap: 8px; margin: 0; }
.aha-sync-hub-status {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
}
.aha-sync-hub-status h3,
.aha-sync-hub-status p { margin: 0; }
.aha-sync-hub-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.aha-sync-hub-row {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: rgba(0,0,0,.12);
}
.aha-sync-hub-row > p,
.aha-sync-hub-footer { color: var(--aha-muted); font-size: .76rem; }
.aha-sync-hub-row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.aha-sync-hub-meta { display: grid; gap: 3px; margin: 0; }
.aha-sync-hub-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--aha-muted);
  font-size: .7rem;
}
.aha-sync-hub-meta dd { margin: 0; color: var(--aha-text); text-align: right; overflow-wrap: anywhere; }
.aha-sync-hub-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  color: var(--aha-muted);
  font-size: .68rem;
  font-weight: 800;
}
.aha-sync-hub-badge.is-ready { color: var(--aha-green); border-color: rgba(53,211,153,.24); background: rgba(53,211,153,.1); }
.aha-sync-hub-badge.is-blocked { color: #ffd2d2; border-color: rgba(255,96,96,.28); background: rgba(255,96,96,.1); }
.aha-sync-target-preview {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 11px;
  background: rgba(255,255,255,.05);
}
.aha-sync-target-preview h4,
.aha-sync-target-preview .eyebrow { margin: 0; }
.aha-sync-target-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.aha-sync-target-preview-decision { color: #ffd2d2; font-size: .78rem; }
.aha-sync-target-preview-plan {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 8px;
  border-radius: 9px;
  background: rgba(0,0,0,.12);
}
.aha-sync-target-preview-plan > div {
  display: grid;
  grid-template-columns: minmax(100px, .45fr) minmax(0, 1fr);
  gap: 8px;
  color: var(--aha-muted);
  font-size: .7rem;
}
.aha-sync-target-preview-plan dd { margin: 0; color: var(--aha-text); overflow-wrap: anywhere; }
.aha-sync-hub-notice { font-size: .78rem; }
.aha-sync-hub-compact-card { padding: 12px; }
.aha-sync-hub-open-button { width: 100%; min-height: 34px; margin-top: 1px; padding: 7px 10px; }

.aha-compact-alert {
  display: grid;
  gap: 5px;
  padding: 8px 9px;
  border: 1px solid rgba(255,96,96,.25);
  border-radius: 10px;
  background: rgba(255,96,96,.08);
  color: #ffd2d2;
  font-size: .75rem;
}
.aha-compact-alert ul { display: grid; gap: 3px; margin: 0; padding-left: 17px; }

.aha-sync-hub-advanced {
  display: grid;
  gap: 12px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.aha-sync-hub-advanced-heading { display: grid; gap: 3px; }
.aha-sync-hub-advanced-heading span { color: var(--aha-muted); font-size: .76rem; line-height: 1.35; }
.aha-sync-hub-advanced .aha-sync-prep-panel { margin-top: 0; }
.aha-sync-hub-advanced .aha-sync-history-panel { margin-top: 0; }

.aha-status-panel > .aha-activity-panel { margin-top: 0; padding: 12px; }
.aha-status-panel > .aha-tech-status { margin-top: 0; }

@media (max-width: 620px) {
  .aha-compact-status-header { align-items: center; }
  .aha-compact-meta > div { flex-wrap: wrap; }
  .aha-compact-meta dd { text-align: left; }
}

/* Compact module health in the AHA Home app menu */
.aha-tile .aha-module-menu-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--aha-text);
}

.aha-tile .aha-module-menu-heading .aha-tile-icon { flex: 0 0 auto; }
.aha-tile .aha-module-menu-heading strong { min-width: 0; }

.aha-module-health-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  margin-top: auto;
  padding: 4px 7px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  color: var(--aha-muted);
  font-size: .69rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.aha-tile .aha-module-health-badge > span { color: inherit; line-height: inherit; }
.aha-module-health-count {
  padding-left: 5px;
  border-left: 1px solid currentColor;
  font-variant-numeric: tabular-nums;
}

.aha-tile .aha-module-health-ready { color: var(--aha-green); background: rgba(53,211,153,.1); border-color: rgba(53,211,153,.24); }
.aha-tile .aha-module-health-warning { color: #ffe27a; background: rgba(255,226,122,.09); border-color: rgba(255,226,122,.22); }
.aha-tile .aha-module-health-blocked { color: #ffb3b3; background: rgba(255,96,96,.11); border-color: rgba(255,96,96,.26); }
.aha-tile .aha-module-health-empty,
.aha-tile .aha-module-health-missing,
.aha-tile .aha-module-health-unknown { color: var(--aha-muted); }

@media (max-width: 820px) {
  .aha-module-health-badge { max-width: 100%; }
}

/* Relevant per-module content in the AHA Home app menu */
.aha-tile .aha-module-summary {
  margin: 0;
  color: var(--aha-muted);
  font-size: .82rem;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.aha-tile .aha-module-tags {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

.aha-tile .aha-module-tags .aha-module-health-badge { margin-top: 0; }

.aha-module-type-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  color: var(--aha-muted);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Per-type accent so each module reads as its own kind of surface */
.aha-tile[data-module-type="personal"] .aha-tile-icon,
.aha-tile[data-module-type="personal"] .aha-module-type-tag { color: #ffd479; border-color: rgba(255, 212, 121, .32); background: rgba(255, 212, 121, .1); }
.aha-tile[data-module-type="core"] .aha-tile-icon,
.aha-tile[data-module-type="core"] .aha-module-type-tag { color: #f6c800; border-color: rgba(246, 200, 0, .38); background: rgba(246, 200, 0, .12); }
.aha-tile[data-module-type="system"] .aha-tile-icon,
.aha-tile[data-module-type="system"] .aha-module-type-tag { color: #8fd0ff; border-color: rgba(143, 208, 255, .3); background: rgba(143, 208, 255, .1); }
.aha-tile[data-module-type="knowledge"] .aha-tile-icon,
.aha-tile[data-module-type="knowledge"] .aha-module-type-tag { color: #b79bff; border-color: rgba(183, 155, 255, .32); background: rgba(183, 155, 255, .1); }
.aha-tile[data-module-type="integration"] .aha-tile-icon,
.aha-tile[data-module-type="integration"] .aha-module-type-tag { color: #6fe3c4; border-color: rgba(111, 227, 196, .3); background: rgba(111, 227, 196, .1); }
.aha-tile[data-module-type="historygo"] .aha-tile-icon,
.aha-tile[data-module-type="historygo"] .aha-module-type-tag { color: #ff9d76; border-color: rgba(255, 157, 118, .32); background: rgba(255, 157, 118, .1); }
.aha-tile[data-module-type="social"] .aha-tile-icon,
.aha-tile[data-module-type="social"] .aha-module-type-tag { color: #ff9ecb; border-color: rgba(255, 158, 203, .32); background: rgba(255, 158, 203, .1); }
.aha-tile[data-module-type="publishing"] .aha-tile-icon,
.aha-tile[data-module-type="publishing"] .aha-module-type-tag { color: #9bd0a0; border-color: rgba(155, 208, 160, .3); background: rgba(155, 208, 160, .1); }

@media (max-width: 720px) {
  .aha-tile .aha-module-summary { -webkit-line-clamp: 2; font-size: .78rem; }
}

/* Final AHA Home polish and accessibility */
.aha-home-panel h1 { margin: 0; letter-spacing: -.04em; }

.aha-skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--aha-yellow);
  color: #171200;
  font-weight: 900;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .15s ease;
}

.aha-skip-link:focus { transform: translateY(0); }

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--aha-color-blue);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(116, 173, 255, .18);
}

:where(button, input, select):disabled,
:where(button, input, select)[aria-disabled="true"] {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .07);
  color: rgba(247, 243, 223, .58);
  cursor: not-allowed;
  opacity: 1;
}

.aha-compact-status-card,
.aha-sync-hub-compact-card,
.aha-sync-history-panel,
.aha-sync-confirmation-section {
  border-color: rgba(255, 255, 255, .15);
}

.aha-compact-status-note,
.aha-compact-empty,
.aha-sync-history-empty,
.aha-sync-history-row span,
.aha-sync-history-row small,
.aha-sync-history-details-grid dt,
.aha-sync-hub-advanced-heading span {
  color: rgba(247, 243, 223, .76);
}

.aha-status-badge,
.aha-module-health-badge,
.aha-sync-retry-badge {
  min-height: 24px;
  line-height: 1.2;
}

.aha-status-badge-neutral,
.aha-tile .aha-module-health-empty,
.aha-tile .aha-module-health-missing,
.aha-tile .aha-module-health-unknown {
  color: rgba(247, 243, 223, .82);
  border-color: rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .08);
}

.aha-sync-history-details-button,
.aha-sync-confirmation-preview-button,
.aha-sync-confirmation-close,
.aha-sync-hub-open-button {
  min-height: 44px;
  min-width: 44px;
}

.aha-sync-history-drawer:focus { outline: none; }
.aha-sync-history-drawer:focus-visible {
  outline: 3px solid var(--aha-yellow);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .aha-sync-confirmation-backdrop {
    align-items: end;
    padding: 8px;
  }

  .aha-sync-confirmation-modal {
    width: 100%;
    max-height: calc(100dvh - 16px);
    padding: 14px;
    border-radius: 16px;
    overscroll-behavior: contain;
  }

  .aha-sync-confirmation-header,
  .aha-sync-confirmation-actions,
  .aha-sync-history-drawer-header {
    align-items: stretch;
  }

  .aha-sync-confirmation-actions > button,
  .aha-sync-history-drawer-header > button {
    min-height: 48px;
  }

  .aha-sync-history-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .aha-module-health-badge,
  .aha-status-badge,
  .aha-sync-retry-badge {
    max-width: 100%;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aha-skip-link { transition: none; }
}

/* Shared AHA module page shell */
.aha-module-shell {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.aha-module-shell-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.aha-module-shell-header > div { min-width: 0; }
.aha-module-shell-header h1,
.aha-module-purpose { margin-bottom: 0; }
.aha-module-purpose { color: var(--aha-muted); }

.aha-module-shell .aha-module-health-badge {
  flex: 0 0 auto;
  position: static;
  max-width: 100%;
}

.aha-module-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.aha-module-content,
.aha-module-content > *,
.aha-module-state { min-width: 0; }

.aha-module-state {
  overflow-wrap: anywhere;
}

.aha-module-state {
  display: grid;
  gap: 6px;
}

.aha-module-state h2,
.aha-module-state p { margin: 0; }
.aha-module-state-title { font-size: 1rem; }
.aha-module-state-title,
.aha-module-state-message,
.aha-module-state-hint,
.aha-module-state-reason { color: var(--aha-muted); }
.aha-module-state-hint,
.aha-module-state-reason { font-size: .88rem; }
.aha-module-error { border-color: rgba(255,96,96,.35); }

.aha-module-details { margin-top: 10px; }
.aha-module-details summary {
  cursor: pointer;
  color: var(--aha-muted);
  font-weight: 700;
}

@media (max-width: 640px) {
  .aha-module-shell-header { flex-direction: column; }
  .aha-module-actions { align-items: stretch; }
  .aha-module-actions > * {
    flex: 1 1 100%;
    justify-content: center;
    text-align: center;
  }
}

/* AHA Training Corpus */
.aha-training-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.aha-training-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.aha-training-item,
.aha-training-example {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aha-training-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.aha-training-consent {
  font-size: .85rem;
  color: var(--aha-muted);
}
.aha-training-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.aha-training-empty {
  color: var(--aha-muted);
}

/* AHA Music Discovery on History Go */
.aha-historygo-music-audit,
.aha-historygo-nearby-music-wrap,
.aha-historygo-place-music-preview { display: grid; gap: 12px; margin-top: 12px; }
.aha-historygo-music-card {
  border: 1px solid var(--aha-line);
  border-radius: 18px;
  padding: 16px;
  background: var(--aha-card-soft);
  display: grid;
  gap: 10px;
}
.aha-historygo-music-chip {
  width: max-content;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--aha-text);
  font-weight: 800;
  font-size: .78rem;
}
.aha-historygo-content-summary,
.aha-historygo-nearby-music li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.aha-historygo-content-summary span,
.aha-historygo-nearby-music span {
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  padding: 4px 9px;
  color: var(--aha-muted);
  font-size: .85rem;
}
.aha-historygo-nearby-music { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.aha-historygo-nearby-music li { justify-content: space-between; border: 1px solid var(--aha-border); border-radius: 12px; padding: 10px 12px; }
.aha-historygo-music-card ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.aha-historygo-music-card p,
.aha-historygo-music-audit p { color: var(--aha-muted); margin: 0; }

.aha-sync-overview {
  display: grid;
  gap: 10px;
}
.aha-sync-overview-grid {
  display: grid;
  gap: 8px;
}
.aha-sync-overview-status {
  margin: 0;
  color: var(--aha-text);
  font-size: .9rem;
}
.aha-sync-overview-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin: 0;
}
.aha-sync-overview-metrics div {
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
}
.aha-sync-overview-metrics dt {
  color: var(--aha-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.aha-sync-overview-metrics dd {
  margin: 2px 0 0;
  font-size: 1rem;
  font-weight: 800;
}
.aha-sync-overview-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: rgba(0,0,0,.1);
}
.aha-sync-overview-card h5,
.aha-sync-overview-details summary,
.aha-sync-channel-registry-details summary { margin: 0; font-size: .82rem; }
.aha-sync-overview-details summary {
  cursor: pointer;
  font-weight: 800;
}
.aha-sync-overview-details[open] summary { margin-bottom: 6px; }
.aha-sync-channel-registry-details {
  display: grid;
  gap: 8px;
}
.aha-sync-channel-registry-details[open] summary { margin-bottom: 8px; }

.aha-local-insight-home { border-color: rgba(245, 187, 48, 0.24); }
.aha-local-home-hero { padding: 1rem; border-radius: 18px; background: linear-gradient(135deg, rgba(245,187,48,.14), rgba(255,255,255,.04)); }
.aha-local-home-hero h2 { margin: .2rem 0 .35rem; }
.aha-local-home-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: .75rem; }
.aha-local-home-card { padding: .85rem; border: 1px solid rgba(255,255,255,.10); border-radius: 16px; background: rgba(255,255,255,.035); }
.aha-local-home-wide { grid-column: 1 / -1; }
.aha-local-card-grid, .aha-local-module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .55rem; }
.aha-local-card, .aha-local-module-tile { display: grid; gap: .25rem; padding: .7rem; border-radius: 14px; border: 1px solid rgba(255,255,255,.10); background: rgba(0,0,0,.12); color: inherit; text-decoration: none; }
.aha-local-card p { margin: 0; }
.aha-local-module-tile span, .aha-local-card small { color: var(--aha-muted, #9ca3af); font-size: .85rem; }
@media (max-width: 760px) { .aha-local-home-layout { grid-template-columns: 1fr; } }

/* AHA Home UX Stabilization V1: scoped compact daily-start layout. */
.aha-local-insight-home {
  border-color: rgba(245, 187, 48, 0.14);
  background: rgba(10, 14, 24, 0.44);
  overflow-x: hidden;
}
.aha-local-insight-home .eyebrow { color: rgba(245, 187, 48, 0.82); }
.aha-home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, max-content);
  align-items: end;
  min-width: 0;
  gap: .75rem;
  padding: .85rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245,187,48,.08), rgba(255,255,255,.025));
}
.aha-home-hero-copy,
.aha-home-hero > div:first-child { min-width: 0; max-width: 72ch; }
.aha-home-hero h2 { font-size: clamp(1.25rem, 2vw, 1.75rem); line-height: 1.08; margin: .15rem 0 .25rem; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.aha-home-hero p { margin: 0; max-width: 68ch; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.aha-home-hero-actions, .aha-local-home-refresh-row { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: flex-end; min-width: 0; }
.aha-home-hero-actions .aha-tile-btn { white-space: nowrap; }
.aha-home-priority-strip { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.aha-home-status-chip, .aha-home-next-chip, .aha-home-source-chip, .aha-home-tag, .aha-home-tag-row span {
  display: inline-flex; align-items: center; gap: .35rem; min-width: 0;
  padding: .32rem .5rem; border: 1px solid rgba(255,255,255,.1); border-radius: 999px;
  background: rgba(255,255,255,.04); color: inherit; font-size: .82rem;
}
.aha-home-status-chip strong { color: #fff; }
.aha-home-main-grid { grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); gap: .6rem; }
.aha-home-main-column { display: grid; gap: .6rem; min-width: 0; }
.aha-local-home-card { padding: .68rem; border-radius: 14px; background: rgba(255,255,255,.028); min-width: 0; }
.aha-home-empty-state { color: var(--aha-muted); border: 1px dashed rgba(255,255,255,.12); border-radius: 12px; padding: .65rem; background: rgba(0,0,0,.10); }
.aha-local-home-card h3 { margin: .12rem 0 .4rem; font-size: 1rem; }
.aha-local-home-card p { margin: .2rem 0; }
.aha-home-highlight-list { grid-template-columns: 1fr; gap: .4rem; }
.aha-home-highlight { padding: .55rem; gap: .18rem; }
.aha-home-highlight p { font-size: .9rem; }
.aha-home-card-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.aha-home-work-queue, .aha-home-tag-list, .aha-home-tag-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.aha-home-work-chip { display: inline-flex; gap: .35rem; align-items: center; padding: .38rem .5rem; border-radius: 12px; background: rgba(0,0,0,.14); color: inherit; text-decoration: none; border: 1px solid rgba(255,255,255,.09); }
.aha-home-recent-list li { padding: .36rem 0; }
.aha-home-module-compact-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .42rem; }
.aha-home-module-compact-tile { min-height: 0; padding: .5rem; gap: .18rem; }
.aha-home-module-compact-tile .aha-home-module-top { display: flex; justify-content: space-between; gap: .45rem; }
.aha-home-module-compact-tile small { border-radius: 999px; padding: .08rem .35rem; background: rgba(245,187,48,.10); color: rgba(255,255,255,.86); white-space: nowrap; }
.aha-home-module-compact-tile em { font-style: normal; color: rgba(245,187,48,.88); font-size: .82rem; }
.aha-home-technical-details { margin-top: .6rem; }
.aha-home-technical-details summary { cursor: pointer; font-weight: 800; }
.aha-home-technical-details pre { overflow: auto; max-height: 220px; font-size: .78rem; }
.aha-local-home-card a:focus-visible, .aha-home-hero-actions a:focus-visible, .aha-local-home-refresh-row button:focus-visible { outline: 2px solid rgba(245,187,48,.85); outline-offset: 2px; }
.aha-local-home-card a:hover, .aha-home-work-chip:hover, .aha-home-module-compact-tile:hover { border-color: rgba(245,187,48,.28); }
@media (max-width: 760px) {
  .aha-home-hero, .aha-home-main-grid { grid-template-columns: minmax(0, 1fr); }
  .aha-home-hero-actions { justify-content: flex-start; }
  .aha-home-hero-actions .aha-tile-btn { white-space: normal; }
  .aha-home-module-compact-grid { grid-template-columns: 1fr; }
  .aha-local-insight-home { max-width: 100%; }
}

/* FIX: AHA Home hero skal ikke klemme teksten på iPad/tablet */
.aha-home-hero {
  grid-template-columns: minmax(260px, 1fr) minmax(0, 320px);
}

.aha-home-hero-actions {
  align-content: end;
}

.aha-home-hero-actions .aha-tile-btn {
  white-space: normal;
  text-align: center;
}

@media (max-width: 1080px) {
  .aha-home-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .aha-home-hero-actions {
    justify-content: flex-start;
  }
}

/* AHA Home patch 2: quieter secondary areas and clearer home sections */
.aha-home-subtitle {
  margin: 6px 0 18px;
  color: var(--aha-muted);
  font-size: .98rem;
  font-weight: 800;
}

.aha-home-section-heading {
  margin: 24px 0 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.09);
}

.aha-home-section-heading:first-of-type {
  margin-top: 16px;
}

.aha-home-section-heading h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  letter-spacing: -.025em;
}

.aha-modules-panel {
  background: rgba(255,255,255,.028);
  border-color: rgba(255,255,255,.075);
  box-shadow: none;
}

.aha-modules-panel > .eyebrow,
.aha-modules-panel .aha-panel-subtitle {
  opacity: .72;
}

.aha-modules-panel .aha-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 7px;
}

.aha-modules-panel .aha-tile {
  min-height: 0;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  box-shadow: none;
}

.aha-modules-panel .aha-tile:hover {
  background: rgba(255,255,255,.06);
}

.aha-modules-panel .aha-tile strong {
  font-size: .92rem;
}

.aha-modules-panel .aha-tile .aha-module-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: .72;
}

.aha-modules-panel .aha-tile small {
  margin-top: 4px;
}

.aha-system-panel {
  font-size: .88rem;
  opacity: .78;
}

.aha-system-panel > summary {
  padding: 2px 0;
}

.aha-system-panel > summary strong {
  font-size: .95rem;
  color: rgba(247,243,223,.82);
}

.aha-system-panel > summary small {
  color: rgba(247,243,223,.48);
  font-size: .78rem;
}

.aha-system-panel-content {
  opacity: .92;
}


/* AHA Home patch 3: app-width feed and overflow-safe layout */
.aha-dashboard {
  width: min(760px, 100%);
  max-width: 100%;
  padding: 10px 10px 104px;
}

.aha-app-shell,
.aha-panel,
.aha-insights-panel,
.aha-local-insight-home,
.aha-local-home-layout,
.aha-home-main-grid,
.aha-home-main-column,
.aha-home-panel,
.aha-modules-panel,
.aha-status-panel,
.aha-system-panel,
.aha-home-hero,
.aha-app-header {
  min-width: 0;
  max-width: 100%;
}

.aha-dashboard,
.aha-dashboard * {
  overflow-wrap: anywhere;
}

.aha-app-header {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "brand"
    "meta"
    "profile"
    "actions";
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  max-height: none;
}

.aha-brand { grid-area: brand; }
.aha-header-meta {
  grid-area: meta;
  flex-wrap: wrap;
  overflow: visible;
}
.aha-header-profile {
  grid-area: profile;
  justify-content: flex-start;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.aha-header-profile #aha-profile-name,
.aha-header-profile #aha-profile-subtitle,
.aha-header-profile #aha-profile-connection {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.aha-header-profile .aha-profile-id-row { max-width: 100%; }

.aha-header-actions {
  grid-area: actions;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.aha-header-actions .aha-cta-primary,
.aha-header-actions .aha-cta-secondary,
.aha-header-actions .aha-ghost-button {
  min-height: 34px;
  padding: 7px 10px;
  white-space: normal;
  border-radius: var(--aha-radius-control);
  flex: 1 1 142px;
}

.aha-home-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 18px;
  padding: 14px;
}

.aha-local-insight-home {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: visible;
  border-radius: 16px;
}

.aha-home-hero,
.aha-local-home-layout,
.aha-home-main-grid {
  grid-template-columns: 1fr;
}

.aha-home-hero {
  align-items: start;
  padding: .7rem;
  border-radius: 14px;
  background: rgba(245,187,48,.055);
}

.aha-home-hero h2,
.aha-home-hero p {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

.aha-home-hero-actions,
.aha-local-home-refresh-row,
.aha-tile-actions,
.aha-action-buttons,
.aha-cta-secondary-row {
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.aha-home-hero-actions { justify-content: flex-start; }
.aha-home-hero-actions .aha-tile-btn,
.aha-tile-btn,
.aha-cta-primary,
.aha-cta-secondary,
.aha-ghost-button {
  white-space: normal;
  min-width: 0;
}

.aha-home-priority-strip,
.aha-home-work-queue,
.aha-home-tag-list,
.aha-home-tag-row {
  min-width: 0;
  max-width: 100%;
}

.aha-home-status-chip,
.aha-home-next-chip,
.aha-home-source-chip,
.aha-home-tag,
.aha-home-tag-row span {
  max-width: 100%;
}

.aha-local-home-card {
  max-width: 100%;
  border-radius: 13px;
  padding: .62rem;
}

.aha-local-card-grid,
.aha-local-module-grid,
.aha-home-module-compact-grid,
.aha-profile-status-grid,
.aha-profile-stats,
.aha-modules-panel .aha-grid {
  grid-template-columns: 1fr;
}

.aha-modules-panel {
  order: 2;
  border-radius: 16px;
}

.aha-modules-panel .aha-grid {
  display: grid;
  gap: 8px;
}

.aha-modules-panel .aha-tile {
  display: grid;
  grid-template-columns: 1fr;
  min-width: 0;
  max-width: 100%;
  border-radius: 13px;
  padding: 10px;
}

.aha-modules-panel .aha-tile .aha-module-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: .72;
}

.aha-system-panel {
  order: 3;
  border-radius: 16px;
  font-size: .86rem;
  opacity: .76;
}

.aha-system-panel-content {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 620px) {
  .aha-dashboard {
    width: 100%;
    padding: 8px 8px 112px;
  }

  .aha-home-panel,
  .aha-panel {
    padding: 12px;
  }

  .aha-header-actions .aha-cta-primary,
  .aha-header-actions .aha-cta-secondary,
  .aha-header-actions .aha-ghost-button {
    flex-basis: 100%;
  }
}

/* AHA Home patch 4: real app home */
body:has(#aha-home-main) .aha-header-actions .aha-cta-primary,
body:has(#aha-home-main) .aha-header-actions #btn-import-hg-primary {
  display: none;
}

.aha-home-panel {
  gap: 10px;
}

.aha-local-insight-home {
  border: 0;
  background: transparent;
  padding: 0;
}

.aha-home-section-heading {
  margin: 10px 0 4px;
  padding-top: 0;
  border-top: 0;
}

.aha-home-subtitle {
  margin-bottom: 0;
}

.aha-home-hero,
.aha-home-priority-strip,
.aha-modules-panel,
.aha-home-modules-compact,
#aha-local-home-module-tiles {
  display: none;
}

.aha-home-app-feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.aha-home-app-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: none;
  padding: 10px;
}

.aha-home-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.aha-home-card-head h2,
.aha-home-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.aha-home-card-head .eyebrow {
  margin-bottom: 2px;
}

.aha-home-card-head .aha-cta-primary,
.aha-home-card-head .aha-cta-secondary {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.aha-local-home-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.aha-local-home-card,
.aha-insights-panel,
.aha-next-panel {
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: none;
}

.aha-home-app-card > .aha-local-home-card,
.aha-home-app-card > .aha-insights-panel,
.aha-home-app-card .aha-local-home-layout > .aha-local-home-card {
  padding: 9px;
  background: rgba(0,0,0,.12);
}

.aha-home-profile-compact {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.aha-home-profile-compact .aha-profile-status-grid,
.aha-home-profile-compact .aha-profile-stats {
  gap: 6px;
}

.aha-home-app-card .aha-panel-head .aha-tile-btn,
.aha-home-app-card .aha-home-hero-actions,
.aha-home-app-card .aha-tile-actions,
.aha-home-app-card a[href="knowledge-workbench.html"] {
  display: none;
}

.aha-home-more-tools,
.aha-home-technical-details,
.aha-system-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  opacity: .58;
  font-size: .82rem;
}

.aha-home-more-tools > summary,
.aha-home-technical-details > summary,
.aha-system-panel > summary {
  cursor: pointer;
  list-style-position: inside;
  padding: 4px 0;
}

.aha-system-panel-content {
  margin-top: 8px;
}

.aha-system-status-link {
  color: rgba(255,255,255,.72);
  text-decoration: none;
}

.aha-system-status-link:hover {
  color: #fff;
  text-decoration: underline;
}

@media (max-width: 620px) {
  .aha-home-card-head {
    flex-direction: column;
  }

  .aha-home-card-head .aha-cta-primary,
  .aha-home-card-head .aha-cta-secondary {
    width: 100%;
    text-align: center;
  }
}

/* AHA Home patch 5: calmer app feed and discreet system surface */
.aha-home-section-heading,
.aha-home-more-tools,
.aha-home-technical-details,
.aha-system-panel-content {
  display: none;
}

.aha-home-panel {
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.aha-home-subtitle {
  margin: 2px 0 2px;
  color: rgba(247,243,223,.66);
  font-weight: 700;
}

.aha-home-app-feed {
  gap: 14px;
}

.aha-home-app-card {
  position: relative;
  gap: 12px;
  overflow: hidden;
  border-radius: var(--aha-radius-panel);
  padding: 16px 16px 16px 18px;
  background: var(--aha-panel-background);
  border: 1px solid var(--aha-line);
  box-shadow: var(--aha-shadow-soft);
}

.aha-home-app-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  opacity: .92;
}

.aha-home-app-card-insight {
  background:
    linear-gradient(145deg, rgba(116,173,255,.11), transparent 42%),
    var(--aha-panel-background);
}
.aha-home-app-card-insight::before { background: var(--aha-color-blue); }

.aha-home-app-card-work {
  background:
    linear-gradient(145deg, rgba(170,145,247,.11), transparent 42%),
    var(--aha-panel-background);
}
.aha-home-app-card-work::before { background: var(--aha-color-violet); }

.aha-home-app-card-mine {
  background:
    linear-gradient(145deg, rgba(88,217,199,.09), transparent 42%),
    var(--aha-panel-background);
}
.aha-home-app-card-mine::before { background: var(--aha-color-cyan); }

.aha-home-card-head {
  align-items: center;
}

.aha-home-card-head h2,
.aha-home-card-head h3 {
  font-size: 1.16rem;
  letter-spacing: -.02em;
}

.aha-home-card-head .eyebrow {
  margin-bottom: 5px;
  color: var(--aha-muted);
  font-size: .68rem;
  letter-spacing: .1em;
}

.aha-home-app-card-insight .aha-home-card-head .eyebrow { color: var(--aha-color-blue); }
.aha-home-app-card-work .aha-home-card-head .eyebrow { color: var(--aha-color-violet); }
.aha-home-app-card-mine .aha-home-card-head .eyebrow { color: var(--aha-color-cyan); }

.aha-home-card-head .aha-cta-primary,
.aha-home-card-head .aha-cta-secondary {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--aha-radius-control);
  font-size: .82rem;
}

.aha-local-home-card,
.aha-insights-panel,
.aha-next-panel,
.aha-home-app-card > .aha-local-home-card,
.aha-home-app-card > .aha-insights-panel,
.aha-home-app-card .aha-local-home-layout > .aha-local-home-card {
  border-color: rgba(255,255,255,.065);
  background: rgba(0,0,0,.105);
  box-shadow: none;
}

.aha-home-main-grid,
.aha-local-home-layout,
.aha-home-profile-compact {
  gap: 8px;
}

.aha-home-app-card .aha-panel-head .aha-tile-btn,
.aha-home-app-card .aha-home-hero-actions,
.aha-home-app-card .aha-tile-actions,
.aha-home-app-card a[href="knowledge-workbench.html"],
.aha-home-app-card a[href="chat.html"].aha-tile-btn,
.aha-home-app-card a[href="chat.html"].aha-cta-secondary {
  display: none;
}

.aha-system-panel {
  display: block;
  margin-top: 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0 2px;
  opacity: 1;
  font-size: .76rem;
}

.aha-system-panel > summary {
  display: block;
  padding: 2px 0;
  color: rgba(247,243,223,.42);
  list-style: none;
  cursor: default;
}

.aha-system-panel > summary::-webkit-details-marker {
  display: none;
}

.aha-system-status-link {
  color: rgba(247,243,223,.42);
  text-decoration: none;
}

.aha-system-status-link:hover,
.aha-system-status-link:focus-visible {
  color: rgba(247,243,223,.78);
  text-decoration: underline;
}

/* AHA Status page */
.aha-status-page {
  width: min(920px, 100%);
}

.aha-status-page-header {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
}

.aha-status-page-header h1,
.aha-status-page-header p {
  margin: 0;
}

.aha-status-page-section {
  margin-bottom: 12px;
}

.aha-status-page .aha-system-panel-content,
.aha-status-page .aha-product-integration-panel,
.aha-status-page .aha-product-flow-panel,
.aha-status-page .aha-status-panel {
  display: block;
  opacity: 1;
}

/* Flat one-line fixed AHA header */
:root {
  --aha-fixed-header-height: 82px;
}

.aha-fixed-header {
  width: min(1180px, 100%);
  min-height: 72px;
  max-height: 88px;
  padding: 8px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.aha-fixed-header .aha-app-header,
.aha-fixed-header .aha-header-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  min-height: 56px;
  max-height: 72px;
  margin: 0;
  padding: 8px 12px;
  overflow: visible;
}

.aha-fixed-header .aha-brand,
.aha-fixed-header .aha-header-meta,
.aha-fixed-header .aha-header-profile,
.aha-fixed-header .aha-header-actions,
.aha-fixed-header .aha-topbar,
.aha-fixed-header .aha-global-nav,
.aha-fixed-header .aha-global-nav-bar {
  flex: 0 0 auto;
  white-space: nowrap;
}

.aha-fixed-header .aha-brand {
  gap: 8px;
}

.aha-fixed-header .aha-brand-mark {
  width: 36px;
  height: 36px;
}

.aha-fixed-header .aha-brand small,
.aha-fixed-header .aha-brand strong {
  white-space: nowrap;
}

.aha-fixed-header .aha-header-meta {
  overflow: visible;
}

.aha-fixed-header .aha-profile-auth-state,
.aha-fixed-header .aha-header-profile #aha-profile-subtitle,
.aha-fixed-header .aha-header-profile #aha-profile-connection,
.aha-fixed-header .aha-header-actions .aha-cta-primary,
.aha-fixed-header .aha-header-actions #btn-import-hg-primary,
.aha-fixed-header .aha-global-nav-brand,
.aha-fixed-header .aha-global-nav-current {
  display: none;
}

.aha-fixed-header .aha-header-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
}

.aha-fixed-header .aha-header-profile .aha-profile-avatar {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  font-size: .76rem;
}

.aha-fixed-header .aha-header-profile .aha-profile-copy {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aha-fixed-header .aha-header-profile #aha-profile-name {
  font-size: .86rem;
  white-space: nowrap;
}

.aha-fixed-header .aha-header-profile .aha-profile-id-row {
  display: inline-flex;
  align-items: center;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: nowrap;
}

.aha-fixed-header .aha-header-actions {
  gap: 6px;
}

.aha-fixed-header .aha-header-actions .aha-ghost-button,
.aha-fixed-header .aha-global-nav-toggle,
.aha-fixed-header .aha-global-nav-home {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.aha-fixed-header .aha-topbar {
  margin: 0;
}

.aha-fixed-header .aha-global-nav-bar {
  min-height: 34px;
  padding: 0;
  gap: 8px;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.aha-main {
  padding-top: calc(var(--aha-fixed-header-height) + 10px);
}

/* Product actions toggle `hidden` as state changes. Keep that semantic state
   authoritative even when a component rule assigns its own display value. */
.aha-v2-materialize-actions [hidden],
#mindmap-v2-materialize[hidden],
#mindmap-v2-undo[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  :root { --aha-fixed-header-height: 82px; }
  .aha-fixed-header { width: 100%; }
  .aha-fixed-header .aha-app-header,
  .aha-fixed-header .aha-header-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    max-height: 72px;
  }
}

@media (max-width: 620px) {
  :root { --aha-fixed-header-height: 80px; }
  .aha-fixed-header {
    padding: 7px 8px;
  }
  .aha-fixed-header .aha-app-header,
  .aha-fixed-header .aha-header-panel {
    width: max-content;
    min-width: 100%;
    padding: 7px 10px;
  }
  .aha-main {
    padding-top: calc(var(--aha-fixed-header-height) + 8px);
  }
}

/* AHA Modules page */
.aha-modules-page {
  width: min(920px, 100%);
}

.aha-modules-page-header {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
}

.aha-modules-page-section {
  margin-bottom: 14px;
}

.aha-modules-page-section h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.aha-modules-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.aha-module-page-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.075);
  background: rgba(255,255,255,.038);
}

.aha-module-page-card h3,
.aha-module-page-card p {
  margin: 0;
}

@media (max-width: 720px) {
  .aha-modules-page-grid {
    grid-template-columns: 1fr;
  }
}


/* Design Consolidation V1: semantic content widths.
   Home keeps the compact app-feed default. Product pages opt into a named
   width instead of carrying one-off max-width declarations in HTML. */
.aha-dashboard.aha-shell-compact {
  width: min(720px, 100%);
  max-width: 720px;
}
.aha-dashboard.aha-shell-reading {
  width: min(900px, 100%);
  max-width: 900px;
}
.aha-dashboard.aha-shell-content {
  width: min(1000px, 100%);
  max-width: 1000px;
}
.aha-dashboard.aha-shell-workspace {
  width: min(1100px, 100%);
  max-width: 1100px;
}
.aha-dashboard.aha-shell-wide {
  width: min(1200px, 100%);
  max-width: 1200px;
}


/* Unified monoline module icon rendering. */
.aha-tile-icon .aha-module-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}

/* Onboarding empty states use the canonical black app surface and shared actions. */
.aha-onboarding-empty {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: clamp(18px, 2.8vw, 28px);
  border: 1px solid rgba(116, 173, 255, .24);
  border-radius: var(--aha-radius-card, 16px);
  background: linear-gradient(115deg, rgba(116, 173, 255, .075), transparent 64%), var(--aha-color-panel, #151515);
  box-shadow: var(--aha-shadow-soft);
}
.aha-onboarding-empty > .eyebrow,
.aha-onboarding-empty > h2,
.aha-onboarding-empty > h3,
.aha-onboarding-empty > p { margin: 0; }
.aha-onboarding-empty > h2,
.aha-onboarding-empty > h3 { line-height: 1.2; }
.aha-onboarding-empty > p:not(.eyebrow) { max-width: 65ch; color: var(--aha-muted); line-height: 1.55; }
.aha-onboarding-empty .aha-tile-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 6px; }
@media (max-width: 600px) {
  .aha-onboarding-empty .aha-tile-actions > .aha-tile-btn { flex: 1 1 155px; text-align: center; }
}
