:root {
  --app-primary: #0d6efd;
  --app-primary-soft: #e8f1ff;
  --app-surface: #ffffff;
  --app-border: #dbe5f0;
  --app-text-soft: #64748b;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background:
    radial-gradient(circle at top left, rgba(13, 110, 253, 0.08), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #f4f7fb 42%, #eef4fb 100%);
  color: #1f2937;
}

.app-shell header {
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-container {
  padding-top: 1rem;
  padding-bottom: 3rem;
}

.nav-link {
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--app-primary) !important;
}

.nav-link.active {
  font-weight: 600;
  color: var(--app-primary) !important;
}

.navbar-brand {
  letter-spacing: 0.01em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, #0d6efd, #2563eb);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 0.35rem 0.9rem rgba(13, 110, 253, 0.25);
}

.logout-form {
  margin: 0;
}

.app-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: #eef4ff;
  color: #24416b;
  font-size: 0.9rem;
}

.app-hero {
  padding: 2rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #0d6efd, #3b82f6);
  color: #fff;
  box-shadow: 0 0.75rem 2rem rgba(13, 110, 253, 0.18);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.app-hero .lead,
.app-hero p {
  color: rgba(255, 255, 255, 0.88);
}

.app-card {
  height: 100%;
  padding: 1.25rem;
  border: 1px solid #dbe5f0;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.5rem 1.25rem rgba(15, 23, 42, 0.08);
}

.dashboard-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--app-primary-soft);
  color: #2453a6;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #fff;
  color: #24416b;
  font-size: 0.85rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0.25rem 0.75rem rgba(13, 110, 253, 0.12);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header p {
  margin-bottom: 0;
  color: #64748b;
}

.empty-state {
  padding: 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.9rem;
  background: #f8fafc;
  color: #475569;
}

.inline-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dashboard-grid .app-card h2 {
  font-size: 1.15rem;
}

.conversation-list .list-group-item {
  padding-left: 0;
  padding-right: 0;
  border-color: #edf2f7;
}

.conversation-list .list-group-item-action:hover {
  background: #f8fbff;
}

.preview-text {
  color: #64748b;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.5rem 0.25rem 0.5rem 0;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}

.chat-message-own {
  align-items: flex-end;
}

.chat-message-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #64748b;
}

.chat-bubble {
  max-width: min(38rem, 100%);
  padding: 0.75rem 1rem;
  border-radius: 1rem 1rem 1rem 0.35rem;
  background: #ffffff;
  box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.08);
}

.chat-message-own .chat-bubble {
  background: #0d6efd;
  color: #fff;
  border-radius: 1rem 1rem 0.35rem 1rem;
}

.chat-composer {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn,
.form-control,
.form-select {
  border-radius: 0.8rem;
}

.form-control,
.form-select {
  border-color: #d3dfef;
}

.issued-code {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  color: #0b3c8c;
  font-weight: 700;
}

.form-floating>.form-control-plaintext::placeholder,
.form-floating>.form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating>.form-control-plaintext:focus::placeholder,
.form-floating>.form-control:focus::placeholder {
  text-align: start;
}

.auth-card {
  padding: 2rem;
  margin-top: 2rem;
}

.auth-card h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
}

.alert {
  border-radius: 0.85rem;
}

@media (max-width: 767.98px) {
  .chat-composer {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-card {
    padding: 1.25rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
}