:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-muted: #f1f5f9;
  --text: #1a2332;
  --text-strong: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #2d9c4a;
  --accent-hover: #248a3f;
  --accent-soft: rgba(45, 156, 74, 0.12);
  --accent-ring: rgba(45, 156, 74, 0.28);
  --mint-glow: rgba(134, 239, 172, 0.45);
  --lavender-glow: rgba(199, 210, 254, 0.5);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --sidebar-width: 228px;
  --persona-panel-max-h: min(34vh, 300px);
  --persona-form-max-h: min(28vh, 248px);
  --persona-btn-row-h: 3.25rem;
}

.text-accent {
  color: var(--accent);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

/* Dashboard only: keep layout within the viewport so the chat composer stays visible */
body:has(.app-shell) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: Outfit, sans-serif;
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, var(--lavender-glow), transparent 55%),
    radial-gradient(ellipse 60% 45% at 100% 0%, var(--mint-glow), transparent 50%),
    radial-gradient(ellipse 55% 40% at 100% 100%, rgba(186, 230, 253, 0.35), transparent 50%),
    radial-gradient(ellipse 50% 40% at 0% 100%, var(--accent-soft), transparent 45%),
    var(--bg);
  color: var(--text);
}

@keyframes login-bg-shift {
  0% {
    background-position:
      0% 0%,
      100% 0%,
      100% 100%,
      0% 100%;
  }
  100% {
    background-position:
      18% 12%,
      82% 8%,
      88% 88%,
      12% 92%;
  }
}

@keyframes login-backdrop-shift {
  0% {
    opacity: 0.85;
    transform: scale(1) translate(0, 0);
  }
  50% {
    opacity: 1;
    transform: scale(1.04) translate(1.5%, -1%);
  }
  100% {
    opacity: 0.9;
    transform: scale(1.02) translate(-1%, 1.5%);
  }
}

.login-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 1.5vh, 16px) clamp(10px, 1.5vw, 14px);
  overflow-x: hidden;
  background-color: #eef3f9;
  background-image:
    radial-gradient(ellipse 80% 65% at 12% 8%, rgba(134, 239, 172, 0.52), transparent 56%),
    radial-gradient(ellipse 78% 60% at 88% 12%, rgba(199, 210, 254, 0.5), transparent 54%),
    radial-gradient(ellipse 72% 58% at 92% 90%, rgba(125, 211, 252, 0.42), transparent 52%),
    radial-gradient(ellipse 70% 55% at 8% 88%, rgba(74, 222, 128, 0.4), transparent 50%);
  background-size: 135% 135%, 130% 130%, 132% 132%, 128% 128%;
  background-repeat: no-repeat;
  background-position:
    0% 0%,
    100% 0%,
    100% 100%,
    0% 100%;
  animation: login-bg-shift 24s ease-in-out infinite alternate;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(196, 181, 253, 0.28), transparent 58%),
    radial-gradient(ellipse 60% 50% at 20% 70%, rgba(45, 156, 74, 0.18), transparent 52%);
  animation: login-backdrop-shift 20s ease-in-out infinite alternate;
}

.login-layout {
  position: relative;
  z-index: 1;
  width: min(1320px, 97vw);
  min-height: min(640px, 84vh);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
  align-items: stretch;
}

.login-hero,
.login-card {
  position: relative;
  border: 1.5px solid rgba(45, 156, 74, 0.38);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  box-shadow:
    0 16px 40px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.login-hero {
  padding: clamp(36px, 4vh, 52px) clamp(36px, 3.5vw, 48px);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-hero-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(22px, 3vw, 40px);
  margin-bottom: clamp(28px, 4vh, 48px);
}

.login-hero-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: clamp(88px, 15vh, 124px);
  max-width: min(400px, 50vw);
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.12)) drop-shadow(0 0 24px rgba(255, 255, 255, 0.65));
}

.login-hero-logo--unipd {
  max-height: clamp(72px, 12vh, 96px);
  max-width: clamp(72px, 12vh, 96px);
  aspect-ratio: 1;
}

.login-hero-logo-divider {
  width: 1.5px;
  height: clamp(72px, 14vh, 100px);
  align-self: center;
  background: linear-gradient(180deg, transparent, rgba(100, 116, 139, 0.45), transparent);
}

.login-hero-eyebrow {
  margin: 0 0 14px;
  font-size: clamp(12px, 1.3vw, 14px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.login-hero-title {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: clamp(30px, 3.6vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.75);
}

.login-hero-lede {
  margin: clamp(12px, 1.8vh, 18px) 0 0;
  max-width: min(48ch, 100%);
  color: var(--muted);
  font-size: clamp(16px, 1.65vw, 19px);
  line-height: 1.5;
}

.login-hero-points {
  margin: clamp(24px, 3vh, 36px) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: clamp(12px, 1.8vh, 18px);
  max-width: min(50ch, 100%);
}

.login-hero-points li {
  position: relative;
  padding-left: clamp(20px, 2vw, 24px);
  color: var(--text);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.45;
}

.login-hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: clamp(8px, 1vw, 10px);
  height: clamp(8px, 1vw, 10px);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-card {
  width: 100%;
  padding: clamp(36px, 4vh, 52px) clamp(36px, 3.5vw, 48px);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card-accent {
  display: none;
}

.login-card-title {
  margin: 8px 0 0;
  font-family: Sora, sans-serif;
  font-size: clamp(28px, 2.8vw, 34px);
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.2;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.75);
}

.login-card-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.45;
}

.login-form {
  margin-top: clamp(26px, 3.5vh, 34px);
  display: grid;
  gap: 14px;
}

.login-form label {
  font-size: clamp(15px, 1.4vw, 16px);
  font-weight: 600;
  color: var(--text);
}

.login-form > input {
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.22);
  color: var(--text-strong);
  font-size: clamp(15px, 1.4vw, 17px);
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.login-form > input:focus {
  outline: none;
  border-color: rgba(45, 156, 74, 0.55);
  background: rgba(255, 255, 255, 0.32);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.login-password-field {
  position: relative;
  display: block;
}

.login-password-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.22);
  color: var(--text-strong);
  font-size: clamp(15px, 1.4vw, 17px);
  padding: 12px 44px 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.login-password-field input:focus {
  outline: none;
  border-color: rgba(45, 156, 74, 0.55);
  background: rgba(255, 255, 255, 0.32);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.login-password-toggle:hover {
  color: var(--text-strong);
  background: var(--surface-muted);
}

.login-password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.login-password-toggle svg {
  grid-area: 1 / 1;
}

.login-form button[type="submit"] {
  margin-top: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: clamp(16px, 1.5vw, 18px);
  padding: 13px 16px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  box-shadow: 0 4px 14px rgba(45, 156, 74, 0.35);
}

.login-form button[type="submit"]:hover {
  background: var(--accent-hover);
}

.error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  color: #b91c1c;
  padding: 12px 14px;
  margin-top: 16px;
  font-size: clamp(14px, 1.35vw, 16px);
  line-height: 1.45;
}

/* —— Projects hub (post-login) —— */
.projects-page {
  --projects-panel-pad-y: clamp(18px, 2.2vh, 26px);
  position: relative;
  min-height: 100dvh;
  box-sizing: border-box;
  padding: clamp(10px, 1.5vh, 16px) clamp(12px, 2vw, 20px);
  overflow-x: hidden;
  background-color: #eef3f9;
  background-image:
    radial-gradient(ellipse 80% 65% at 12% 8%, rgba(134, 239, 172, 0.4), transparent 56%),
    radial-gradient(ellipse 78% 60% at 88% 12%, rgba(199, 210, 254, 0.45), transparent 54%);
}

.projects-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 50% 40%, rgba(196, 181, 253, 0.2), transparent 58%);
}

.projects-page-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: clamp(260px, 18vw, 300px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(16px, 2.5vw, 36px);
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 clamp(8px, 1.5vw, 20px);
}

.projects-account-rail {
  justify-self: start;
  width: 100%;
  max-width: 300px;
  padding-top: max(0px, calc(var(--projects-panel-pad-y) - 11px));
  position: sticky;
  top: clamp(10px, 1.5vh, 16px);
}

.projects-account-menu {
  position: relative;
}

.projects-account-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px 12px 12px;
  border: 1.5px solid rgba(45, 156, 74, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.projects-account-trigger:hover {
  border-color: rgba(45, 156, 74, 0.45);
  box-shadow: 0 8px 22px rgba(45, 156, 74, 0.12);
}

.projects-account-trigger::-webkit-details-marker {
  display: none;
}

.projects-account-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.projects-account-avatar svg {
  width: 22px;
  height: 22px;
}

.projects-account-trigger__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}

.projects-account-trigger__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.projects-account-trigger__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projects-account-chevron {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.projects-account-menu:not([open]) .projects-account-chevron {
  transform: rotate(-45deg);
}

.projects-account-dropdown {
  margin-top: 12px;
  padding: 18px 18px 20px;
  border: 1.5px solid rgba(45, 156, 74, 0.22);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
}

.projects-account-dropdown__title {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.projects-account-dropdown__user {
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(45, 156, 74, 0.12);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  word-break: break-word;
}

.projects-account-info {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.projects-account-info__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.projects-account-info__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.projects-account-info__icon svg {
  width: 16px;
  height: 16px;
}

.projects-account-info__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.projects-account-info__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.projects-account-info__value {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-strong);
}

.projects-account-dropdown > .sidebar-partners {
  margin-top: 16px;
  margin-bottom: 24px;
  padding: 14px 12px;
  gap: 12px 16px;
}

.projects-account-dropdown .sidebar-partner-logo {
  height: clamp(50px, 6.5vh, 58px);
  max-width: min(230px, 100%);
}

.projects-account-dropdown .sidebar-partner-logo--unipd {
  max-width: clamp(48px, 6vh, 56px);
  max-height: clamp(48px, 6vh, 56px);
}

.projects-account-signout {
  padding-top: 40px;
  margin-top: 8px;
}

.projects-account-dropdown__hint {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(45, 156, 74, 0.08);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.account-sign-out {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: none;
  background-color: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.account-sign-out:hover,
.account-sign-out:focus-visible {
  background-color: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.account-sign-out:active {
  background-color: #1f7a38;
  color: #fff;
}

.projects-center {
  display: flex;
  justify-content: stretch;
  min-width: 0;
}

.projects-shell {
  position: relative;
  width: 100%;
  max-width: none;
}

.projects-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 12px);
}

.projects-logo--stat4value {
  max-height: clamp(56px, 7.5vh, 72px);
  max-width: min(280px, 38vw);
}

.projects-logo--unipd {
  max-height: clamp(52px, 7vh, 68px);
  max-width: clamp(52px, 7vh, 68px);
  aspect-ratio: 1;
}

.projects-logo {
  width: auto;
  object-fit: contain;
  display: block;
}

.projects-panel-head {
  margin-bottom: clamp(14px, 2vh, 20px);
}

.projects-panel-head__text {
  flex: 1 1 auto;
  min-width: 0;
}

.projects-header-text {
  flex: 1 1 220px;
  min-width: 0;
}

.projects-header-text h1 {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: clamp(22px, 2.8vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.projects-eyebrow {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: clamp(13px, 1.5vw, 15px);
  line-height: 1.4;
}

.projects-logout {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: #9f1239;
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 4px;
}

.projects-logout:hover {
  color: #7f1d1d;
  text-decoration: underline;
}

.projects-grid {
  display: grid;
  grid-template-columns: minmax(200px, 28%) minmax(0, 1fr);
  gap: clamp(10px, 1.5vw, 14px);
  align-items: start;
}

.projects-main-panel {
  padding: var(--projects-panel-pad-y) clamp(20px, 2.8vw, 32px);
  border: 1.5px solid rgba(45, 156, 74, 0.32);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
}

.projects-main-panel > h1 {
  margin: 0 0 8px;
  font-family: Sora, sans-serif;
  font-size: clamp(22px, 2.8vw, 28px);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--text-strong);
}

.projects-panel-head__text > h1 {
  margin: 0 0 8px;
  font-family: Sora, sans-serif;
  font-size: clamp(22px, 2.8vw, 28px);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--text-strong);
}

.projects-account-trigger__name {
  line-height: 1.15;
}

.projects-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-bottom: 8px;
}

.projects-title-row h1 {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: clamp(22px, 2.8vw, 28px);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--text-strong);
}

.projects-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.projects-action-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, opacity 0.15s;
}

.projects-action-btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.projects-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.projects-action-btn--pending:disabled {
  opacity: 0.55;
  background: #94a3b8;
  cursor: not-allowed;
}

.projects-sentiment-status {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.projects-instruction {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.projects-panel-head__text .projects-instruction {
  margin: 0;
}

.projects-list-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.projects-list-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.projects-loading {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.projects-list-heading {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}

.projects-list-history {
  margin-top: 4px;
  border: 1.5px solid rgba(45, 156, 74, 0.22);
  border-radius: var(--radius-md);
  background: rgba(248, 250, 252, 0.9);
  overflow: hidden;
}

.projects-list-history__summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  user-select: none;
}

.projects-list-history__summary::-webkit-details-marker {
  display: none;
}

.projects-list-history__summary::after {
  content: "▾";
  float: right;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.projects-list-history:not([open]) .projects-list-history__summary::after {
  transform: rotate(-90deg);
}

.projects-list-history__body {
  padding: 0 12px 12px;
}

.projects-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  --projects-col-dashboard: 236px;
  --projects-col-run: 212px;
  --projects-col-view: 230px;
}

.projects-row {
  display: grid;
  grid-template-columns:
    minmax(0, 1.6fr)
    minmax(0, var(--projects-col-dashboard))
    minmax(0, var(--projects-col-run))
    minmax(0, var(--projects-col-view));
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
  width: 100%;
  min-width: min(100%, 920px);
  padding: 14px 16px 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: visible;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.projects-row:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(45, 156, 74, 0.1);
}

.projects-row.is-active {
  border-color: var(--accent);
  background: rgba(45, 156, 74, 0.05);
  box-shadow: 0 4px 14px rgba(45, 156, 74, 0.1);
}

.projects-row__info {
  grid-column: 1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  align-self: center;
}

.projects-row__tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.projects-row__name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projects-row-btn[data-action="dashboard"] {
  grid-column: 2;
  grid-row: 1;
}

.projects-row-btn[data-action="run-sentiment"] {
  grid-column: 3;
  grid-row: 1;
}

.projects-action-hint--run {
  grid-column: 3;
  grid-row: 2;
  align-self: start;
}

.projects-row__view-slot {
  grid-column: 4;
  grid-row: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 4px;
  align-items: center;
  align-self: center;
  min-width: 0;
}

.projects-row__view-slot .projects-row-btn[data-action="view-results"] {
  grid-column: 1;
  grid-row: 1;
}

.projects-row__view-slot .projects-row-delete {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: center;
}

.projects-row__view-slot .projects-action-hint--view {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: start;
}

.projects-row-delete {
  flex-shrink: 0;
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 999px;
  line-height: 1;
  font-size: 15px;
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.projects-row-delete:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #f87171;
  transform: scale(1.05);
}

.projects-row-delete:focus-visible {
  outline: 2px solid #f87171;
  outline-offset: 2px;
}

.projects-row-delete:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.projects-row .projects-action-btn {
  width: 100%;
  min-width: 0;
  padding-left: 10px;
  padding-right: 10px;
  text-align: center;
}

.projects-action-hint {
  margin: 0;
  padding: 0 2px;
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
  color: #64748b;
}

.projects-action-hint[hidden] {
  display: none;
}

.projects-action-hint--run {
  color: #92600a;
}

.projects-action-hint--view {
  color: #64748b;
}

.projects-row:not([data-status-loaded="true"]) .projects-action-hint {
  display: none !important;
}

.projects-row .projects-action-btn[data-action="run-sentiment"] {
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.projects-row--analyzing .projects-action-btn[data-action="run-sentiment"]:disabled,
.projects-row--run-pending .projects-action-btn[data-action="run-sentiment"]:disabled {
  opacity: 0.88;
  cursor: wait;
}

.projects-row__date {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projects-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  font: inherit;
  color: inherit;
}

.projects-list-item:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(45, 156, 74, 0.1);
}

.projects-list-item.is-active {
  border-color: var(--accent);
  background: rgba(45, 156, 74, 0.06);
  box-shadow: 0 4px 14px rgba(45, 156, 74, 0.12);
}

.projects-list-item__tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.projects-list-item__name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-strong);
}

.projects-list-item__meta {
  font-size: 12px;
  color: var(--muted);
}

.projects-list-item__date {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.projects-create-toggle {
  align-self: flex-start;
  margin-top: 4px;
  padding: 11px 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.projects-create-toggle:hover {
  filter: brightness(1.05);
}

.projects-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.projects-modal.is-open {
  display: flex;
}

.projects-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
}

.projects-modal__panel {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(90dvh, 720px);
  overflow-y: auto;
  padding: clamp(16px, 2vh, 22px);
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1.5px solid rgba(45, 156, 74, 0.32);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}

.projects-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.projects-modal__header h2 {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: 18px;
}

.projects-modal__close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}

.projects-modal__close:hover {
  color: var(--text-strong);
}

.projects-modal--danger .projects-modal__panel {
  width: min(440px, 100%);
  border-color: rgba(220, 38, 38, 0.35);
}

.projects-modal__panel--compact {
  max-height: none;
  overflow: visible;
}

.projects-delete-lead {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-strong);
}

.projects-delete-lead strong {
  color: #b91c1c;
}

.projects-delete-desc {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.projects-delete-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.projects-delete-btn-cancel,
.projects-delete-btn-confirm {
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.projects-delete-btn-cancel {
  background: var(--surface-muted);
  color: var(--text-strong);
  border: 1px solid var(--border);
}

.projects-delete-btn-cancel:hover {
  background: #f1f5f9;
}

.projects-delete-btn-confirm {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28);
}

.projects-delete-btn-confirm:hover:not(:disabled) {
  background: #b91c1c;
}

.projects-delete-btn-confirm:disabled {
  opacity: 0.7;
  cursor: wait;
}

.projects-field--full {
  grid-column: 1 / -1;
}

.projects-list-panel,
.projects-create-panel {
  padding: clamp(12px, 1.5vh, 16px) clamp(12px, 1.5vw, 16px);
  border: 1.5px solid rgba(45, 156, 74, 0.32);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
}

.projects-panel-head {
  margin-bottom: 10px;
}

.projects-panel-head h2 {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: 1.25;
}

.projects-panel-hint {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.projects-error {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 13px;
}

.project-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(420px, 55dvh);
  overflow-y: auto;
}

.project-card {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(45, 156, 74, 0.12);
}

.project-card.is-active {
  border-color: var(--accent);
  background: rgba(45, 156, 74, 0.06);
}

.project-card__name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-strong);
}

.project-card__meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.project-card__meta--muted {
  font-size: 11px;
}

.project-card__date {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

.projects-empty {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  line-height: 1.45;
}

.projects-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.projects-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px clamp(8px, 1.2vw, 12px);
}

.projects-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.projects-form label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.projects-form label .required {
  color: #b91c1c;
}

.projects-form input,
.projects-form select,
.projects-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  box-sizing: border-box;
}

.projects-form textarea {
  resize: vertical;
  min-height: 3.2em;
  max-height: 8em;
}

.projects-submit {
  width: 100%;
  margin: 0;
  padding: 11px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.projects-submit:hover:not(:disabled) {
  filter: brightness(1.05);
}

.projects-submit:disabled {
  cursor: wait;
  opacity: 0.92;
}

.projects-form.is-submitting input,
.projects-form.is-submitting textarea,
.projects-form.is-submitting select {
  pointer-events: none;
}

.projects-submit.is-busy {
  position: relative;
}

.projects-nav-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 4000;
  background: rgba(238, 242, 247, 0.72);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  align-items: center;
  justify-content: center;
}

.projects-nav-overlay.is-visible {
  display: flex;
  animation: projects-nav-overlay-fade-in 170ms ease-out both;
}

.projects-nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: min(440px, calc(100vw - 48px));
  padding: 32px 40px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
}

.projects-nav-spinner {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid rgba(45, 156, 74, 0.22);
  border-top-color: var(--accent);
  animation: projects-nav-spin 0.85s linear infinite;
}

.projects-nav-overlay p {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.35;
  color: var(--text-strong);
  font-weight: 600;
}

.projects-nav-subtext {
  margin: 0;
  max-width: 32ch;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}

@keyframes projects-nav-overlay-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Tablet: stack columns, keep 2-col form */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .projects-page-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .projects-account-rail {
    max-width: 360px;
    position: static;
  }

  .projects-center {
    justify-content: stretch;
  }

  .projects-shell {
    width: 100%;
  }

  .project-cards {
    max-height: min(280px, 35dvh);
  }
}

/* Narrow tablet / large phone */
@media (max-width: 768px) {
  .projects-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .projects-row__info,
  .projects-row__date,
  .projects-row-btn,
  .projects-row-delete,
  .projects-action-hint {
    grid-column: auto;
    grid-row: auto;
    align-self: auto;
  }

  .projects-row__date {
    text-align: left;
  }

  .projects-row .projects-action-btn {
    width: 100%;
  }

  .projects-row__view-slot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .projects-row__view-slot .projects-row-btn[data-action="view-results"] {
    flex: 1 1 180px;
    min-width: 0;
  }

  .projects-row__view-slot .projects-row-delete {
    flex: 0 0 22px;
    margin-left: auto;
  }

  .projects-row__view-slot .projects-action-hint--view {
    flex: 1 1 100%;
    width: 100%;
    margin: 0;
  }

  .projects-action-hint {
    margin-top: -4px;
    text-align: left;
    font-size: 11px;
  }

  .projects-form-grid {
    grid-template-columns: 1fr;
  }

  .project-cards {
    max-height: none;
    overflow: visible;
  }
}

/* Phone */
@media (max-width: 480px) {
  .projects-page {
    padding: 8px 10px 20px;
  }

  .projects-form input,
  .projects-form select,
  .projects-form textarea {
    font-size: 16px;
  }
}

.sidebar-project-name {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sidebar-back-projects {
  display: block;
  width: 100%;
  margin-top: 8px;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}

.sidebar-back-projects:hover {
  color: #fff;
  text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  .login-page,
  .login-backdrop {
    animation: none;
  }
}

@media (max-width: 900px) {
  .login-layout {
    grid-template-columns: 1fr;
    width: min(640px, 100%);
    gap: 14px;
  }

  .login-hero {
    min-height: auto;
    text-align: center;
  }

  .login-card {
    min-height: auto;
  }

  .login-hero-logos {
    justify-content: center;
  }

  .login-hero-logo {
    object-position: center;
    max-width: min(520px, 90vw);
    max-height: min(172px, 32vw);
  }

  .login-hero-logo-divider {
    height: min(120px, 26vw);
  }

  .login-hero-lede,
  .login-hero-points {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
  }

  .login-hero-points li {
    text-align: left;
  }
}

.app-shell {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  box-sizing: border-box;
  overflow: hidden;
}

@keyframes dashboard-shell-enter {
  from {
    opacity: 0;
    transform: translate3d(18px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.app-shell.app-shell--enter {
  animation: dashboard-shell-enter 220ms cubic-bezier(0.25, 0.9, 0.3, 1) both;
}

.app-shell > .history-sidebar {
  min-height: 0;
}

.history-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.history-sidebar > .brand,
.history-sidebar > .sidebar-partners,
.history-sidebar > .sidebar-new-persona-btn {
  flex-shrink: 0;
}

.history-sidebar > .sidebar-panel--history {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-panel--history.is-open {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 8px 8px;
}

/* Match original <summary> look — reset native <button> chrome */
.sidebar-panel--history .sidebar-panel__summary {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 4px;
  width: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
  flex-shrink: 0;
}

.sidebar-panel--history .sidebar-panel__summary:hover {
  color: var(--text);
}

.sidebar-panel--history .sidebar-panel__summary:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.sidebar-panel--history:not(.is-open) .sidebar-panel__summary {
  margin: 0 2px 4px;
  padding: 0 4px 0 0;
  width: auto;
}

.sidebar-panel--history.is-open > .sidebar-panel__body {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.sidebar-panel--history.is-open > .sidebar-panel__body::-webkit-scrollbar {
  width: 6px;
}

.sidebar-panel--history.is-open > .sidebar-panel__body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.sidebar-panel--history:not(.is-open) > .sidebar-panel__body {
  display: none;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  font-family: Sora, sans-serif;
  line-height: 1.25;
  color: var(--text-strong);
}

.brand p,
.brand small {
  margin: 6px 0 0;
  color: var(--muted);
}

.history-title {
  margin: 0 2px -6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.sidebar-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sidebar-panel:not(.is-open) {
  flex: 0 0 auto;
}

.sidebar-panel--history:not(.is-open) {
  flex: 0 0 auto;
}

.sidebar-panel__summary {
  margin: 0 2px 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}

.sidebar-panel__summary::-webkit-details-marker {
  display: none;
}

.sidebar-panel__summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.sidebar-panel[open] > .sidebar-panel__summary::after,
.sidebar-panel.is-open > .sidebar-panel__summary::after {
  transform: rotate(45deg);
  margin-top: -3px;
}

.sidebar-panel__body {
  min-height: 0;
}

.history-list {
  display: grid;
  gap: 6px;
  align-content: start;
}

.history-entry {
  position: relative;
}

.history-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text-strong);
  cursor: pointer;
  padding: 7px 28px 7px 9px;
  display: grid;
  gap: 2px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.history-item:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.history-item-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item small {
  color: var(--muted);
  font-size: 10px;
}

.history-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.history-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  line-height: 18px;
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.history-delete:hover {
  background: #fef2f2;
  border-color: #f87171;
  transform: scale(1.05);
}

.history-delete:focus-visible {
  outline: 2px solid #f87171;
  outline-offset: 2px;
}

.toast-area {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1100;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 28px));
}

.toast {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-strong);
  box-shadow: var(--shadow-lg);
  padding: 11px 12px;
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast-success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.toast-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.toast-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}

.toast-confirm .toast-text {
  color: var(--text-strong);
  margin-bottom: 9px;
  font-weight: 600;
}

.toast-danger {
  border-color: #fecaca;
  background: #fef2f2;
  box-shadow: var(--shadow-lg);
}

.toast-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-actions button {
  border: none;
  border-radius: 9px;
  padding: 7px 11px;
  font-weight: 600;
  cursor: pointer;
}

.toast-btn-cancel {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.toast-btn-delete {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.toast-btn-delete:hover {
  background: #b91c1c;
}

.toast-hide {
  opacity: 0;
  transform: translateY(-6px);
}

.history-empty {
  color: var(--muted);
  font-size: 12px;
}

.history-empty.is-loading {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
}

.history-empty.is-loading::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: history-loading-spin 0.95s linear infinite;
  flex-shrink: 0;
}

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

.main-pane {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.personas-top,
.persona-setup-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

.persona-setup-panel[open] {
  flex: 0 0 auto;
  max-height: var(--persona-panel-max-h);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.persona-setup-panel[open] > .persona-setup-panel__summary {
  flex: 0 0 auto;
}

.persona-setup-panel[open] > .persona-setup-form {
  flex: 0 0 auto;
  max-height: var(--persona-form-max-h);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Slightly taller cap when creating a new persona (panel still compact) */
.app-shell[data-selected-persona=""] {
  --persona-panel-max-h: min(40vh, 330px);
  --persona-form-max-h: min(33vh, 270px);
}

/* Active chat: keep persona panel small so chat stays visible */
.app-shell[data-selected-persona]:not([data-selected-persona=""]) .persona-setup-panel[open] {
  --persona-panel-max-h: min(30vh, 260px);
  --persona-form-max-h: min(24vh, 215px);
}

.persona-setup-panel__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
}

.persona-setup-panel__summary::-webkit-details-marker {
  display: none;
}

.persona-setup-panel__summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.persona-setup-panel[open] > .persona-setup-panel__summary::after {
  transform: rotate(45deg);
  margin-top: -3px;
}

.personas-top h2,
.persona-setup-panel__summary h2 {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: 13px;
  line-height: 1.25;
  color: var(--text-strong);
}

.personas-top-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.secondary-action {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text-strong);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.secondary-action:hover {
  text-decoration: none;
}

.secondary-action:disabled {
  opacity: 0.72;
  cursor: wait;
}

.persona-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.persona-card {
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--persona-color), var(--border) 70%);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--persona-color), var(--surface) 88%);
  color: var(--text-strong);
  cursor: pointer;
  padding: 14px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  box-shadow: var(--shadow-sm);
}

.persona-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.persona-card.active {
  border-color: color-mix(in srgb, var(--persona-color), #fff 30%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--persona-color), transparent 60%);
}

.persona-card.pending {
  transform: scale(0.99);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--persona-color), #ffffff 55%);
  opacity: 0.88;
}

.persona-card:disabled {
  cursor: wait;
}

.persona-card h3 {
  margin: 0;
  font-size: 16px;
}

.persona-card p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.persona-setup-panel[open] .persona-setup-form {
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.persona-setup-form {
  min-height: 0;
}

.persona-setup-scroll {
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(var(--persona-form-max-h) - var(--persona-btn-row-h) - 0.5rem);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.persona-setup-actions {
  flex: 0 0 var(--persona-btn-row-h);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.persona-setup-actions button {
  width: 100%;
}

.persona-setup-form.is-locked {
  opacity: 0.58;
}

.persona-setup-form textarea {
  resize: vertical;
  min-height: 36px;
  max-height: 72px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-strong);
  padding: 8px;
  font-size: 13px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.feature-control {
  display: grid;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 6px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 10px;
}

.feature-control > span {
  font-weight: 600;
  color: var(--text-strong);
  font-size: 10px;
  line-height: 1.2;
}

.feature-control select {
  width: 100%;
  max-width: 100%;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-strong);
  padding: 3px 5px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.slider-row input[type="range"] {
  width: 100%;
}

.slider-row output {
  min-width: 24px;
  text-align: right;
  color: var(--accent);
  font-weight: 700;
}

#startSimulationBtn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  background: var(--accent);
  box-shadow: 0 3px 10px rgba(45, 156, 74, 0.3);
  transition: background 0.15s ease;
}

#startSimulationBtn:hover {
  background: var(--accent-hover);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 6px;
  flex-shrink: 0;
}

.sidebar-partners {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  flex-shrink: 0;
}

.sidebar-partner-logo {
  display: block;
  height: clamp(44px, 6vh, 52px);
  width: auto;
  max-width: min(200px, 100%);
  object-fit: contain;
  object-position: center;
  opacity: 1;
}

.sidebar-partner-logo--unipd {
  max-width: clamp(40px, 5.5vh, 48px);
  max-height: clamp(40px, 5.5vh, 48px);
  width: auto;
  aspect-ratio: 1;
}

.sidebar-new-persona-btn {
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
  font-size: 11px;
  line-height: 1.3;
  padding: 8px 10px;
  cursor: pointer;
  text-align: center;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sidebar-new-persona-btn:hover {
  border-color: var(--accent-hover);
  background: rgba(45, 156, 74, 0.18);
}

.sidebar-new-persona-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.manager-box {
  padding-top: 0;
  border-top: none;
}

.manager-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.manager-box .account-sign-out {
  margin-top: 10px;
}

.chat-pane {
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.chat-log {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 10px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  scrollbar-width: thin;
}

.chat-log--welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0 20px;
}

.chat-start-compose {
  width: min(100%, 640px);
  margin: 0 auto;
}

.chat-start-compose__title {
  margin: 0 0 16px;
  font-family: Sora, sans-serif;
  font-size: clamp(17px, 2.2vw, 22px);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: var(--text-strong);
}

.chat-start-compose__form {
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.chat-start-compose__form textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  max-height: 160px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-strong);
  font-size: 14px;
  line-height: 1.4;
  padding: 11px 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-start-compose__form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.bubble {
  max-width: 78%;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.bubble .role {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 600;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-strong);
}

.bubble.user {
  justify-self: end;
  background: var(--accent);
  border: 1px solid var(--accent-hover);
}

.bubble.user .role {
  color: rgba(255, 255, 255, 0.85);
}

.bubble.user p {
  color: #fff;
}

.bubble.assistant {
  justify-self: start;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.bubble.typing {
  min-width: 96px;
  min-height: 44px;
}

.bubble.typing .typing-dots {
  padding: 4px 0 2px;
}

.typing-dots {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 18px;
}

.typing-dots span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  animation: typing-bounce 1.1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

.empty-state {
  place-self: center;
  text-align: center;
  font-size: 13px;
}

.empty-state h3 {
  margin-bottom: 6px;
  font-size: 15px;
  color: var(--text-strong);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  flex-shrink: 0;
  align-self: stretch;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 8px 10px;
}

.chat-form textarea {
  resize: vertical;
  min-height: 48px;
  max-height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-strong);
  font-size: 13px;
  line-height: 1.35;
  padding: 8px 11px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.chat-form button {
  align-self: center;
  height: 48px;
  border: none;
  border-radius: var(--radius-sm);
  min-width: 84px;
  padding: 0 20px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  background: var(--accent);
  box-shadow: 0 3px 10px rgba(45, 156, 74, 0.28);
  transition: background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-form button:hover {
  background: var(--accent-hover);
}

.chat-form.chat-form--hidden {
  display: none;
}

@media (max-height: 820px) {
  :root {
    --persona-panel-max-h: min(36vh, 280px);
    --persona-form-max-h: min(30vh, 230px);
  }

  .app-shell[data-selected-persona=""] {
    --persona-panel-max-h: min(40vh, 300px);
    --persona-form-max-h: min(33vh, 250px);
  }
}

@media (max-height: 640px) {
  :root {
    --persona-panel-max-h: min(38vh, 260px);
    --persona-form-max-h: min(31vh, 210px);
  }

  .app-shell[data-selected-persona=""] {
    --persona-panel-max-h: min(42vh, 280px);
    --persona-form-max-h: min(34vh, 230px);
  }
}

@media (max-width: 1280px) {
  .feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1040px) {
  :root {
    --sidebar-width: 212px;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .history-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: min(190px, 28vh);
    flex: 0 1 auto;
    overflow: hidden;
  }

  .history-sidebar:has(.sidebar-panel--history.is-open),
  .history-sidebar.is-history-expanded {
    max-height: min(360px, 52vh);
    overflow: hidden;
  }

  .history-sidebar:has(.sidebar-panel--history.is-open) .sidebar-partners,
  .history-sidebar.is-history-expanded .sidebar-partners {
    display: none;
  }

  .sidebar-panel--history:not(.is-open) {
    margin-bottom: -4px;
  }

  .sidebar-panel--history.is-open,
  .history-sidebar.is-history-expanded .sidebar-panel--history {
    flex: 1 1 0;
    min-height: 0;
  }

  .sidebar-panel--history.is-open > .sidebar-panel__body,
  .history-sidebar.is-history-expanded .sidebar-panel__body {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .history-entry {
    min-width: 0;
  }

  .main-pane {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    --persona-panel-max-h: min(38dvh, 300px);
    --persona-form-max-h: min(31dvh, 250px);
  }

  .app-shell[data-selected-persona=""] .main-pane {
    --persona-panel-max-h: min(42dvh, 320px);
    --persona-form-max-h: min(34dvh, 265px);
  }

  .chat-pane {
    flex: 1 1 auto;
    min-height: min(42dvh, 340px);
  }

  .persona-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .main-pane {
    --persona-panel-max-h: min(40dvh, 290px);
    --persona-form-max-h: min(32dvh, 235px);
  }

  .app-shell[data-selected-persona=""] .main-pane {
    --persona-panel-max-h: min(44dvh, 310px);
    --persona-form-max-h: min(35dvh, 255px);
  }

  .feature-grid,
  .persona-list {
    grid-template-columns: 1fr;
  }

  .login-hero-logos {
    justify-content: center;
  }

  .login-hero-logo {
    max-height: 56px;
    object-position: center;
  }
}

/* --- App section nav (Persona / Sentiment) --- */
.sidebar-app-nav {
  display: grid;
  gap: 6px;
  margin: 10px 0 12px;
}

.sidebar-nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sidebar-nav-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sidebar-nav-link.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-strong);
}

/* --- Sentiment analysis page --- */
body:has(.sentiment-shell),
body:has(.sentiment-page) {
  height: auto;
  max-height: none;
  overflow: auto;
}

.sentiment-shell {
  min-height: 100dvh;
}

.sentiment-page-body,
.sentiment-main {
  overflow: auto;
  padding: 18px 20px 28px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.sentiment-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sentiment-header h2 {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: 22px;
}

.sentiment-lede {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 52ch;
}

.sentiment-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.sentiment-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-action {
  border: none;
  border-radius: 10px;
  background-color: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.primary-action:hover,
.primary-action:focus-visible {
  background-color: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.primary-action:active {
  background-color: #1f7a38;
  color: #fff;
}

.primary-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sentiment-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric-card strong {
  font-size: 24px;
  font-family: Sora, sans-serif;
}

.metric-card strong.pos {
  color: var(--accent);
}

.metric-card strong.neg {
  color: #dc2626;
}

.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.card-panel h3 {
  margin: 0 0 10px;
  font-family: Sora, sans-serif;
  font-size: 16px;
}

.sentiment-summary {
  min-height: 340px;
  padding: 24px 26px;
}

.sentiment-summary__body p {
  margin: 0 0 0.85rem;
  line-height: 1.6;
  color: var(--text);
}

.sentiment-summary__body p:last-child {
  margin-bottom: 0;
}

.sentiment-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.sentiment-charts--stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  margin: 0;
  grid-template-columns: unset;
}

.sentiment-charts--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sentiment-charts--grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card {
  margin: 0;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

.chart-card--centered {
  width: 100%;
  max-width: none;
  align-items: stretch;
}

.chart-card__caption {
  margin: 0 0 10px;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}

.chart-card img {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  object-position: left top;
  display: block;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.chart-card:not(.chart-card--scatter) img {
  min-height: 240px;
}

.chart-card--scatter {
  padding-bottom: 8px;
}

.chart-card--scatter img {
  min-height: 0;
  height: auto;
  vertical-align: top;
}

.polarity-plotly-host {
  width: 100%;
}

/* Polarity scatter: plot left, colourful legend right (ViolaPulse-style) */
.pv-scatter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  grid-template-rows: auto;
  column-gap: 16px;
  align-items: start;
  width: 100%;
}

.pv-scatter__plot-wrap {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  width: 100%;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  overflow: hidden;
}

.pv-scatter__plot {
  width: 100%;
  height: 440px;
  min-height: 440px;
}

.pv-scatter__legend {
  grid-column: 2;
  grid-row: 1;
  width: 200px;
  padding: 6px 0 0 4px;
}

.pv-scatter__legend-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}

.pv-scatter__legend-items {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pv-scatter__legend-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text);
}

.pv-scatter__legend-item:hover .pv-scatter__legend-label {
  opacity: 0.85;
}

.pv-scatter__legend-item.is-off {
  opacity: 0.38;
}

.pv-scatter__legend-item.is-off .pv-scatter__legend-label {
  text-decoration: line-through;
}

.pv-scatter__legend-dot {
  display: block;
  justify-self: center;
  align-self: center;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
}

.pv-scatter__legend-label {
  min-width: 0;
}

.polarity-plotly__empty {
  margin: 0;
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.chart-card--scatter .pv-scatter {
  min-height: 440px;
}

.sentiment-methodology {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}

.chart-card--wide {
  grid-column: 1 / -1;
}

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

.sentiment-category-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.sentiment-category-list .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.sample-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.sample-list li {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.sample-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.sample-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.sample-meta .pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-strong);
  font-weight: 600;
}

.sample-list p {
  margin: 0;
  line-height: 1.45;
  font-size: 14px;
}

.sentiment-empty {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
}

.sentiment-empty h3 {
  margin: 0 0 8px;
}

.sentiment-empty p {
  margin: 0 0 16px;
  color: var(--muted);
}

.sentiment-scope-bar {
  display: grid;
  gap: 10px;
}

.sentiment-scope-bar__head {
  display: grid;
  gap: 4px;
}

.sentiment-scope-label {
  font-family: Sora, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.sentiment-scope-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.sentiment-scope-bar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.sentiment-scope-select {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: Outfit, sans-serif;
}

.sentiment-stale-banner {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  background: #fffbeb;
  color: #92400e;
}

.sentiment-stale-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.sentiment-stale-banner p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.sentiment-view-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.sentiment-view-banner.is-session {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
}

.view-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.sentiment-view-banner.is-session .view-badge {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.view-meta {
  font-size: 13px;
  color: var(--muted);
  width: 100%;
}

.sentiment-charts--session {
  grid-template-columns: 1fr;
}

.sentiment-charts--aspects {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sentiment-taxonomy h3 {
  margin: 0 0 4px;
  font-family: Sora, sans-serif;
  font-size: 15px;
}

.sentiment-taxonomy-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.aspect-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.aspect-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.aspect-chip.is-detected {
  border-color: #166534;
  background: linear-gradient(135deg, #166534 0%, #ffffff 100%);
  color: #1a2332;
}

.aspect-chip--placeholder {
  font-style: italic;
}

.sentiment-aspect-insights .aspect-insight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.aspect-insight-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.aspect-insight-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.aspect-insight-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
}

.aspect-insight-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.aspect-insight-meta {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.aspect-insight-item p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.sentiment-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(238, 243, 249, 0.92);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s ease, visibility 0.14s ease;
}

.sentiment-loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.app-nav-overlay {
  z-index: 10000;
}

.sentiment-loading-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  max-width: min(440px, calc(100vw - 48px));
}

.sentiment-loading-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sentiment-spin 0.85s linear infinite;
}

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

.sentiment-loading-title {
  margin: 0 0 8px;
  font-family: Sora, sans-serif;
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 600;
  line-height: 1.35;
}

.sentiment-loading-sub {
  margin: 0;
  font-size: clamp(14px, 1.6vw, 16px);
  color: var(--muted);
  line-height: 1.45;
}

body.sentiment-is-loading {
  overflow: hidden;
}

.sentiment-page {
  min-height: 100dvh;
  background: #eef3f9;
  display: flex;
  flex-direction: column;
}

.sentiment-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(45, 156, 74, 0.25);
  background: rgba(255, 255, 255, 0.96);
}

.sentiment-topbar__brand {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 24px);
  flex-shrink: 0;
}

.sentiment-topbar__logo {
  max-height: clamp(52px, 7vh, 68px);
  width: auto;
  max-width: min(280px, 38vw);
  object-fit: contain;
}

.sentiment-topbar__logo--unipd {
  max-height: clamp(48px, 6.5vh, 64px);
  max-width: clamp(48px, 6.5vh, 64px);
  aspect-ratio: 1;
}

.sentiment-topbar__center {
  flex: 1 1 220px;
  min-width: 0;
}

.sentiment-topbar__center h1 {
  margin: 0;
  font-family: Sora, sans-serif;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.sentiment-topbar__project {
  margin: 6px 0 0;
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

.sentiment-topbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.sentiment-topbar__actions .primary-action,
.sentiment-scope-bar__row .primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
}

.sentiment-topbar__actions .primary-action:hover,
.sentiment-scope-bar__row .primary-action:hover {
  color: #fff;
  text-decoration: none;
}

.sentiment-page-body {
  flex: 1;
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 18px 20px 28px;
  box-sizing: border-box;
}

.sentiment-aspect-table .sentiment-table-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

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

.aspect-sentiment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.aspect-sentiment-table th,
.aspect-sentiment-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.aspect-sentiment-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.aspect-table-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.aspect-source-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface-muted);
  color: var(--muted);
}

.aspect-source-pill--emergent {
  background: #fef3c7;
  color: #92400e;
}

.aspect-source-pill--llm {
  background: #e0e7ff;
  color: #3730a3;
}

.aspect-source-pill--taxonomy {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

@media (max-width: 900px) {
  .sentiment-charts--aspects {
    grid-template-columns: 1fr;
  }
}

.persona-score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.persona-score-table th,
.persona-score-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.persona-score-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
}

.persona-score-table td.pos,
.persona-score-table td.neg {
  font-weight: 600;
  font-family: Sora, sans-serif;
}

.table-link {
  color: var(--accent-hover);
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}

.table-link:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .sentiment-metrics,
  .sentiment-charts,
  .sentiment-charts--pair,
  .sentiment-charts--grid {
    grid-template-columns: 1fr;
  }

  .chart-card:not(.chart-card--scatter) img {
    min-height: 200px;
  }

  .chart-card--scatter img {
    min-height: 0;
  }
}
