.levita-portal {
  --levita-portal-text: #18212b;
  --levita-portal-muted: #5e6d7d;
  --levita-portal-border: #d8e0ea;
  --levita-portal-border-strong: #c4cfdd;
  --levita-portal-surface: #ffffff;
  --levita-portal-surface-soft: #f4f7fb;
  --levita-portal-surface-alt: #edf3ff;
  --levita-portal-accent: #2753c7;
  --levita-portal-accent-strong: #18378f;
  --levita-portal-shadow: 0 28px 70px rgba(18, 35, 62, 0.1);
  font-family: "Manrope", sans-serif;
  color: var(--levita-portal-text);
}

.levita-portal-auth,
.levita-portal-app {
  width: 1300px;
  max-width: 100%;
  margin: 0 auto;
}

.levita-portal-auth__panel,
.levita-portal-app {
  background:
    radial-gradient(circle at top right, rgba(39, 83, 199, 0.1), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
  border: 1px solid var(--levita-portal-border);
  border-radius: 30px;
  box-shadow: var(--levita-portal-shadow);
}

.levita-portal-brandmark {
  display: flex;
  justify-content: center;
  margin: 0 auto 18px;
}

.levita-portal-brandmark img {
  display: block;
  max-width: min(260px, 70vw);
  height: auto;
}

.levita-portal-auth__panel {
  max-width: 480px;
  margin: 40px auto;
  padding: 32px;
}

.levita-portal-auth__brand,
.levita-portal-app__eyebrow,
.levita-portal-section-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--levita-portal-accent);
}

.levita-portal-auth__title,
.levita-portal-app__title {
  margin: 10px 0 8px;
  font-size: 30px;
  line-height: 1.02;
}

.levita-portal-auth__text,
.levita-portal-app__subtitle,
.levita-portal-card__header p,
.levita-portal-toolbar__note,
.levita-portal-empty,
.levita-portal-info-row span,
.levita-portal-conversation div,
.levita-portal-conversation small,
.levita-portal-faq-placeholder p,
.levita-portal-faq-content,
.levita-portal-faq-content p,
.levita-portal-faq-content li {
  margin: 0;
  color: var(--levita-portal-muted);
}

.levita-portal-login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.levita-portal-field {
  display: grid;
  gap: 8px;
}

.levita-portal-field span {
  font-size: 13px;
  font-weight: 700;
  color: #384552;
}

.levita-portal-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--levita-portal-border-strong);
  background: #fff;
  font-size: 16px;
  color: var(--levita-portal-text);
}

.levita-portal-field input:focus {
  outline: none;
  border-color: var(--levita-portal-accent);
  box-shadow: 0 0 0 4px rgba(39, 83, 199, 0.14);
}

.levita-portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--levita-portal-accent);
  border-radius: 14px;
  background: var(--levita-portal-accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.levita-portal-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(39, 83, 199, 0.22);
  background: var(--levita-portal-accent-strong);
  color: #fff;
}

.levita-portal-button--ghost {
  background: rgba(255, 255, 255, 0.88);
  color: var(--levita-portal-text);
  border-color: var(--levita-portal-border-strong);
  box-shadow: none;
}

.levita-portal-button--ghost:hover {
  color: #fff;
}

.levita-portal-alert {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 700;
}

.levita-portal-alert--error {
  background: #fff1f1;
  border: 1px solid #f3b7b7;
  color: #9e2323;
}

.levita-portal-alert--success {
  background: #edf9ef;
  border: 1px solid #b8e1bf;
  color: #216738;
}

.levita-portal-app {
  padding: 32px;
}

.levita-portal-app__header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 4px 4px 28px;
  border-bottom: 1px solid rgba(196, 207, 221, 0.7);
}

.levita-portal-app__header-copy {
  max-width: 760px;
}

.levita-portal-app__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.levita-portal-app__logo {
  width: auto;
  max-width: 130px;
  max-height: 48px;
  display: block;
}

.levita-portal-app__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.levita-portal-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(39, 83, 199, 0.14);
  background: rgba(39, 83, 199, 0.08);
  color: var(--levita-portal-accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.levita-portal-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin: 24px 0 22px;
}

.levita-portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.levita-portal-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 133px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--levita-portal-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #445363;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.levita-portal-tab:hover {
  border-color: var(--levita-portal-border-strong);
}

.levita-portal-tab.is-active {
  background: var(--levita-portal-text);
  border-color: var(--levita-portal-text);
  color: #fff;
}

.levita-portal-toolbar__note {
  max-width: 360px;
  font-size: 14px;
  line-height: 1.5;
  text-align: right;
}

.levita-portal-panel {
  display: block;
}

.levita-portal-panel[hidden] {
  display: none !important;
}

.levita-portal-workspace {
  display: grid;
  gap: 18px;
}

.levita-portal-history-layout {
  display: grid;
  gap: 18px;
}

.levita-portal-workspace {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  align-items: start;
}

.levita-portal-workspace__main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.levita-portal-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--levita-portal-border);
  border-radius: 24px;
  padding: 24px;
  min-width: 0;
}

.levita-portal-card__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.levita-portal-card__header h3,
.levita-portal-card h3 {
  margin: 8px 0 6px;
  font-size: 22px;
  line-height: 1.15;
}

.levita-portal-card__header p {
  margin: 0;
  line-height: 1.55;
}

.levita-portal-account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.levita-portal-detail-card--license .levita-portal-detail-card__value {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.levita-portal-license-text {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.levita-portal-copy-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--levita-portal-border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--levita-portal-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.levita-portal-copy-button:hover {
  border-color: var(--levita-portal-accent);
  color: var(--levita-portal-accent);
}

.levita-portal-detail-card,
.levita-portal-mini-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--levita-portal-border);
  background: linear-gradient(180deg, #fbfdff 0%, #f1f5fb 100%);
}

.levita-portal-detail-card__label,
.levita-portal-mini-card span {
  display: block;
  margin-bottom: 8px;
  color: #687788;
  font-size: 13px;
  font-weight: 700;
}

.levita-portal-detail-card__value,
.levita-portal-mini-card strong {
  display: block;
  font-size: 20px;
  line-height: 1.25;
  color: var(--levita-portal-text);
  overflow-wrap: anywhere;
}

.levita-portal-detail-card__meta {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--levita-portal-muted);
}

.levita-portal-info-list {
  display: grid;
  gap: 14px;
}

.levita-portal-info-row {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--levita-portal-surface-soft);
  border: 1px solid var(--levita-portal-border);
}

.levita-portal-info-row strong {
  font-size: 15px;
}

.levita-portal-stats-stack {
  display: grid;
  gap: 22px;
}

.levita-portal-stats-section {
  display: grid;
  gap: 14px;
}

.levita-portal-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.levita-portal-conversation-list,
.levita-portal-history-list {
  display: grid;
  gap: 10px;
}

.levita-portal-conversation-list {
  padding-top: 1px;
}

.levita-portal-card--history-list,
.levita-portal-card--history-thread {
  height: 600px;
}

.levita-portal-card--history-list [data-portal-conversations],
.levita-portal-card--history-thread [data-portal-history] {
  height: calc(100% - 130px);
  min-height: 0;
}

.levita-portal-conversation-list,
.levita-portal-history-list {
  max-height: 100%;
  overflow: auto;
  padding-right: 4px;
}

.levita-portal-conversation {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--levita-portal-border);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  overflow: hidden;
}

.levita-portal-conversation strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--levita-portal-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.levita-portal-conversation div {
  margin-bottom: 8px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.levita-portal-conversation small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.levita-portal-conversation:hover,
.levita-portal-conversation.is-active {
  border-color: rgba(39, 83, 199, 0.45);
  background: var(--levita-portal-surface-alt);
  transform: translateY(-1px);
}

.levita-portal-history-item {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--levita-portal-border);
  background: #fff;
}

.levita-portal-history-item--user {
  background: linear-gradient(180deg, #2d5cd6 0%, #2048b0 100%);
  border-color: #2149b4;
  color: #fff;
}

.levita-portal-history-item--assistant {
  background: #f8fafc;
}

.levita-portal-history-role {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.levita-portal-history-content {
  white-space: pre-wrap;
  line-height: 1.65;
}

.levita-portal-history-meta {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.72;
}

.levita-portal-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed var(--levita-portal-border-strong);
  background: rgba(244, 247, 251, 0.9);
  line-height: 1.6;
}

.levita-portal-faq-content {
  line-height: 1.7;
}

.levita-portal-faq-content > :first-child {
  margin-top: 0;
}

.levita-portal-faq-content > :last-child {
  margin-bottom: 0;
}

.levita-portal-faq-content ul,
.levita-portal-faq-content ol {
  padding-left: 20px;
}

.levita-portal-faq-support {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--levita-portal-border);
}

.levita-portal-faq-support strong {
  display: block;
  margin-bottom: 6px;
}

.levita-portal-faq-support a {
  color: var(--levita-portal-accent);
  font-weight: 700;
  text-decoration: none;
}

.levita-portal-faq-placeholder {
  padding: 20px;
  border-radius: 18px;
  border: 1px dashed var(--levita-portal-border-strong);
  background: var(--levita-portal-surface-soft);
}

.levita-portal-faq-placeholder h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.levita-portal-faq-placeholder p {
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 1080px) {
  .levita-portal-toolbar,
  .levita-portal-workspace,
  .levita-portal-overview {
    grid-template-columns: 1fr;
  }

  .levita-portal-toolbar__note {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 760px) {
  .levita-portal-app {
    padding: 18px;
    border-radius: 24px;
  }

  .levita-portal-auth__panel {
    margin: 24px auto;
    padding: 24px;
  }

  .levita-portal-app__header,
  .levita-portal-account-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .levita-portal-button--ghost {
    justify-self: start;
  }

  .levita-portal-card {
    padding: 18px;
    border-radius: 20px;
  }

  .levita-portal-card--history-list,
  .levita-portal-card--history-thread {
    height: auto;
  }

  .levita-portal-card--history-list [data-portal-conversations],
  .levita-portal-card--history-thread [data-portal-history],
  .levita-portal-history-list {
    height: auto;
    max-height: none;
  }
}
