:root {
  color-scheme: light;
  --brand-primary: #2563eb;
  --brand-primary-dark: #1d4ed8;
  --brand-accent: #a855f7;
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-elevated: #fdfdfd;
  --color-border: rgba(15, 23, 42, 0.08);
  --color-muted: #64748b;
  --color-text: #0f172a;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 20px 60px rgba(15, 23, 42, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-primary: #60a5fa;
  --brand-primary-dark: #3b82f6;
  --brand-accent: #c084fc;
  --color-bg: #0b1120;
  --color-surface: #111827;
  --color-surface-elevated: #1f2937;
  --color-border: rgba(148, 163, 184, 0.12);
  --color-muted: #94a3b8;
  --color-text: #e2e8f0;
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 30px 80px rgba(0, 0, 0, 0.65);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
}

a:hover {
  color: var(--brand-primary-dark);
}

.app-shell {
  min-height: 100vh;
  background-image: radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.12), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(168, 85, 247, 0.12), transparent 40%);
  background-color: var(--color-bg);
}

.app-navbar {
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  border-bottom: 1px solid var(--color-border);
}

.app-navbar .navbar-brand {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.app-navbar .navbar-toggler {
  border: 1px solid var(--color-border);
  border-radius: 0.85rem;
  background: var(--color-surface-elevated);
  min-width: 44px;
  min-height: 44px;
  padding: 0.45rem 0.65rem;
}

.app-navbar .navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.company-logo {
  display: block;
  object-fit: contain;
}

.company-logo-wide {
  width: auto;
  height: 48px;
  max-width: min(380px, 42vw);
}

.company-banner {
  width: 100%;
  height: clamp(280px, 36vw, 560px);
  border-radius: 16px;
  border: 1px solid var(--color-border);
  display: block;
  object-fit: cover;
  object-position: center;
  background: var(--color-surface-elevated);
}

.company-banner-picture {
  display: block;
}

.nav-link,
.navbar-text {
  color: var(--color-muted) !important;
}

.nav-link.active,
.nav-link:hover {
  color: var(--brand-primary) !important;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  font-size: 0.9rem;
  background: var(--color-surface-elevated);
  color: var(--color-text);
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.theme-toggle .icon {
  font-size: 0.95rem;
}

.app-content {
  padding: 2rem 0 4rem;
}

.app-card {
  background: var(--color-surface);
  border-radius: 1.25rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

.bg-gradient {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(168, 85, 247, 0.15));
}

.metric-card {
  border-radius: 1.25rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.metric-card-link .metric-card {
  height: 100%;
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-primary);
}

.metric-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--color-muted);
}

.metric-value {
  font-size: 2rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

.badge-outline {
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
}

.feature-list {
  list-style: none;
  padding-left: 0;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.feature-list li::before {
  content: "•";
  color: var(--brand-primary);
}

.text-muted {
  color: var(--color-muted) !important;
}

.list-group {
  border-radius: 1rem;
}

.list-group-item {
  background: var(--color-surface-elevated);
  border-color: var(--color-border);
  color: var(--color-text);
  transition: background 0.2s ease, color 0.2s ease;
}

.list-group-flush .list-group-item {
  border-left: 0;
  border-right: 0;
}

.list-group-item .text-muted,
.list-group-item small {
  color: var(--color-muted) !important;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.section-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.dashboard-header__text {
  max-width: 36rem;
}

.btn-explore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.agent-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.agent-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.agent-meta .status-pill {
  align-self: flex-start;
}

.agent-actions {
  text-align: right;
}

.agent-actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.agent-actions-row .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.history-link {
  color: var(--color-text);
  text-decoration: none;
  display: block;
}

.history-link:hover .history-preview {
  color: var(--brand-primary);
}

.recent-conversation-link {
  display: block;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 0.8rem;
  padding: 0.25rem 0.35rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.recent-conversation-link:hover,
.recent-conversation-link:focus-visible {
  color: inherit;
  background: rgba(37, 99, 235, 0.08);
}

.conversation-list .conversation-list-item {
  color: var(--color-text);
  text-decoration: none;
}

.conversation-list-item:hover,
.conversation-list-item:focus-visible {
  background: rgba(37, 99, 235, 0.08);
}

.readonly-conversation {
  max-height: 70vh;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
}

.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-modern thead {
  background: var(--color-surface-elevated);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.table-modern th,
.table-modern td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.table-modern tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

.btn-soft {
  border-radius: 999px;
  padding: 0.45rem 1.6rem;
  font-weight: 500;
  border: none;
  background: var(--brand-primary);
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}

.btn-soft:hover {
  transform: translateY(-2px);
  background: var(--brand-primary-dark);
}

.btn-soft.btn-danger {
  border-radius: 999px;
  padding: 0.48rem 1.7rem;
  font-weight: 600;
  border: none;
  background: linear-gradient(135deg, #ff9090, #ff5c5c) !important;
  color: #fff !important;
  box-shadow: 0 12px 32px rgba(255, 92, 92, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-soft.btn-danger:hover,
.btn-soft.btn-danger:focus-visible {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #ff6a6a, #ff3b3b) !important;
  box-shadow: 0 14px 34px rgba(255, 92, 92, 0.45);
  color: #fff !important;
}

.btn-outline-soft {
  border-radius: 999px;
  padding: 0.45rem 1.6rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.company-context-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  font-weight: 600;
}

.company-context-toggle.dropdown-toggle::after {
  margin-left: 0.35rem;
}

.company-context-menu {
  min-width: 250px;
  border: 1px solid var(--color-border);
  border-radius: 0.9rem;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  padding: 0.35rem;
}

.company-context-menu .dropdown-item {
  border-radius: 0.65rem;
  color: var(--color-text);
  padding: 0.5rem 0.7rem;
}

.company-context-menu .dropdown-item:hover,
.company-context-menu .dropdown-item:focus {
  background: rgba(37, 99, 235, 0.12);
  color: var(--brand-primary);
}

.company-context-menu .dropdown-item-text {
  border-radius: 0.65rem;
  padding: 0.5rem 0.7rem;
}

.btn-outline-soft.btn-outline-soft-danger {
  color: #dc3545;
  border-color: rgba(220, 53, 69, 0.4);
}

.btn-outline-soft.btn-outline-soft-danger:hover,
.btn-outline-soft.btn-outline-soft-danger:focus {
  color: #b02a37;
  border-color: rgba(220, 53, 69, 0.7);
  background: rgba(220, 53, 69, 0.1);
}

.plan-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.plan-current-card {
  border: 1px solid rgba(37, 99, 235, 0.25);
  box-shadow: 0 20px 50px rgba(37, 99, 235, 0.14);
}

.plan-card.is-current {
  border: 1px solid rgba(37, 99, 235, 0.28);
}

.plan-current-card .progress {
  height: 0.6rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
}

.plan-current-card .progress-bar {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  border-radius: inherit;
}

.plan-card.is-featured {
  border: 1px solid rgba(37, 99, 235, 0.2);
  box-shadow: 0 20px 50px rgba(37, 99, 235, 0.15);
}

.plan-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.12);
}

.plan-card.is-featured:hover {
  box-shadow: 0 26px 55px rgba(37, 99, 235, 0.2);
}

.plan-ribbon {
  position: absolute;
  top: 1rem;
  right: -2.2rem;
  background: linear-gradient(135deg, #ffb347, #ff7a45);
  color: #fff;
  padding: 0.35rem 2.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(35deg);
  box-shadow: 0 10px 22px rgba(255, 122, 69, 0.35);
}

.branding-upload-card {
  border: 1px solid var(--color-border);
  box-shadow: none;
}

.branding-guidelines {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.branding-guideline-card {
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background: var(--color-surface-elevated);
  padding: 1rem 1rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.branding-guideline-card strong {
  font-size: 1.05rem;
  color: var(--color-text);
}

.branding-guideline-card small {
  color: var(--color-muted);
  line-height: 1.45;
}

.branding-guideline-card__eyebrow {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-primary);
}

.branding-current-file {
  margin-bottom: 0.9rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: 0.85rem;
  background: var(--color-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.branding-current-file__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.branding-current-file__label {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.branding-current-file__link {
  color: var(--brand-primary);
  text-decoration: none;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.branding-current-file__link:hover {
  text-decoration: underline;
}

.branding-clear-button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  flex: 0 0 auto;
}

.branding-preview {
  width: 100%;
  border: 1px dashed var(--color-border);
  border-radius: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-elevated);
  overflow: hidden;
  position: relative;
}

.branding-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.6rem;
}

.branding-preview__empty {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--color-muted);
  text-align: center;
  padding: 1rem;
  border: 0;
  background: transparent;
  width: 100%;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.branding-preview__empty i {
  font-size: 1.65rem;
  color: var(--brand-primary);
  opacity: 0.75;
}

.branding-preview__empty span {
  font-size: 0.9rem;
  font-weight: 500;
}

.branding-preview.is-empty .branding-preview__empty {
  display: flex;
}

.branding-preview.is-empty .branding-preview__empty:hover,
.branding-preview.is-empty .branding-preview__empty:focus-visible {
  background: rgba(49, 36, 235, 0.05);
  color: var(--color-text);
  outline: none;
}

.branding-preview.is-empty img {
  display: none !important;
}

.branding-preview-logo-desktop {
  aspect-ratio: 4 / 1;
  min-height: 0;
}

.branding-preview-logo-desktop img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.branding-preview-banner {
  aspect-ratio: 3 / 2;
  min-height: 0;
}

.branding-preview-banner img {
  width: 100%;
  height: 100%;
}

.branding-preview-banner-mobile {
  aspect-ratio: 1 / 1;
  min-height: 0;
}

.branding-preview-banner-mobile img {
  width: 100%;
  height: 100%;
}

.branding-crop-wrapper {
  width: 100%;
  min-height: 260px;
  max-height: 66vh;
  border-radius: 0.9rem;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.04);
}

.branding-crop-wrapper img {
  display: block;
  max-width: 100%;
}

.agent-form-actions {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.agent-form-actions__primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.agent-form-actions__danger {
  margin-left: auto;
}

.auth-container {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0 auto;
}

.auth-shell {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  background: radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.12), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(168, 85, 247, 0.15), transparent 50%);
  border-radius: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 1.5rem;
  border: 1px solid rgba(37, 99, 235, 0.08);
  box-shadow: 0 35px 70px rgba(15, 23, 42, 0.18);
  padding: 2.75rem 2.25rem;
}

.auth-card__header h1 {
  font-size: 1.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.auth-card__header p {
  color: var(--color-muted);
  margin-bottom: 0;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(37, 99, 235, 0.12);
  color: var(--brand-primary);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 1.1rem;
  margin-bottom: 1rem;
}

.auth-form {
  margin-top: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-form__field {
  display: flex;
  flex-direction: column;
}

.auth-form__field label {
  font-weight: 500;
  display: block;
  margin-bottom: 0.35rem;
}

.auth-form input {
  width: 100%;
  border-radius: 0.95rem;
  border: 1px solid rgba(15, 23, 42, 0.15);
  padding: 0.85rem 1rem;
  background: rgba(248, 250, 255, 0.9);
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-form input:focus {
  border-color: var(--brand-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.auth-error {
  font-size: 0.8rem;
  color: #dc3545;
  margin-top: 0.35rem;
}

.auth-submit {
  margin-top: 0.7rem;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  border-radius: 0.95rem;
}

.auth-card__footer {
  margin-top: 1.6rem;
}

.auth-card__footer a {
  font-weight: 500;
}

.auth-alert {
  background: rgba(220, 53, 69, 0.12);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #9f1239;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  margin-top: 1.5rem;
}

.agent-form .form-switch .form-check-input {
  width: 3.2rem;
  height: 1.6rem;
  margin-top: 0;
}

.company-settings-page {
  position: relative;
}

.company-settings-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(168, 85, 247, 0.08)),
    var(--color-surface);
}

.company-settings-hero__layout {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.company-settings-hero__content {
  max-width: 720px;
}

.company-settings-hero__kicker {
  display: inline-flex;
  margin-bottom: 0.6rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--brand-primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.company-settings-hero__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.company-settings-limit-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.company-settings-limit-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
}

.company-settings-panel {
  padding: 1.7rem;
}

.company-settings-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.company-settings-panel__header--docs {
  margin-bottom: 1.4rem;
}

.company-settings-panel--control {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    var(--color-surface);
}

.company-settings-resource-stack {
  display: grid;
  gap: 1rem;
}

.company-settings-resource {
  border: 1px solid var(--color-border);
  border-radius: 1.1rem;
  background: var(--color-surface-elevated);
  padding: 1rem;
}

.company-settings-resource__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.company-settings-resource__kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.company-settings-resource__description {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.company-settings-copy-button {
  white-space: nowrap;
}

.company-settings-secret-card__value {
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 0.95rem;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(168, 85, 247, 0.08)),
    var(--color-surface);
  padding: 0.95rem 1rem;
  margin-bottom: 0.95rem;
}

.company-settings-secret-card__value code,
.company-settings-doc-url code,
.company-settings-pre code,
.company-settings-response-card code {
  display: block;
  color: var(--color-text);
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.company-settings-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.company-settings-action-grid .btn {
  min-height: 42px;
  padding: 0.55rem 1rem;
  font-size: 0.96rem;
  font-weight: 600;
  box-shadow: none;
}

.company-settings-action-grid .btn-soft {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
}

.company-settings-action-grid .btn-soft:hover {
  transform: none;
  background: linear-gradient(135deg, var(--brand-primary-dark), var(--brand-primary-dark));
}

.company-settings-status-card {
  margin-top: 1.15rem;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(168, 85, 247, 0.04)),
    var(--color-surface-elevated);
}

.company-settings-footer {
  margin-top: 1.15rem;
}

.company-settings-doc-url,
.company-settings-doc-card,
.company-settings-pre,
.company-settings-response-card {
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background: var(--color-surface-elevated);
  padding: 1rem 1.05rem;
}

.company-settings-doc-url {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(168, 85, 247, 0.05)),
    var(--color-surface-elevated);
}

.company-settings-pre {
  padding: 0.95rem 1rem;
}

.company-settings-pre__label {
  margin-bottom: 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.company-settings-playground__textarea {
  min-height: 320px;
}

.company-settings-response-card {
  height: 100%;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.02), rgba(15, 23, 42, 0.05)),
    var(--color-surface-elevated);
}

.integration-toggle-panel {
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background: var(--color-surface-elevated);
  padding: 1rem 1.1rem;
}

.integration-toggle-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.integration-toggle-form {
  flex-shrink: 0;
}

.integration-toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.integration-toggle-switch .form-check-input {
  width: 3.3rem;
  height: 1.8rem;
  margin: 0;
  cursor: pointer;
  border-color: rgba(15, 23, 42, 0.14);
  background-color: rgba(100, 116, 139, 0.2);
  box-shadow: none;
}

.integration-toggle-switch .form-check-input:checked {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.integration-toggle-switch .form-check-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18);
}

.integration-toggle-switch .form-check-label {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  line-height: 1.2;
}

.integration-toggle-label {
  font-weight: 600;
  color: var(--color-text);
}

.integration-toggle-state {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.student-detail-meta p {
  color: var(--color-text);
}

.student-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.student-metric-card,
.student-extra-item {
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background: var(--color-surface-elevated);
  padding: 1rem 1.1rem;
}

.student-metric-card__label,
.student-extra-item__label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
}

.student-metric-card__value,
.student-extra-item__value {
  font-size: 1.4rem;
  line-height: 1.1;
}

.student-extra-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.student-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.student-timeline__item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 0.9rem;
}

.student-timeline__marker {
  position: relative;
  width: 18px;
  min-height: 100%;
}

.student-timeline__marker::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: 8px;
  bottom: -1.3rem;
  width: 2px;
  background: rgba(37, 99, 235, 0.2);
}

.student-timeline__item:last-child .student-timeline__marker::before {
  display: none;
}

.student-timeline__marker::after {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.student-timeline__content {
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background: var(--color-surface-elevated);
  padding: 1rem 1.1rem;
}

.student-extra-json {
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  padding: 1rem 1.1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 576px) {
  .auth-card {
    padding: 2.2rem 1.6rem;
  }

  .company-settings-panel {
    padding: 1.25rem;
  }

  .company-settings-resource__header {
    flex-direction: column;
    align-items: stretch;
  }

  .company-settings-action-grid {
    grid-template-columns: 1fr;
  }

  .integration-toggle-panel__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .student-metric-grid,
  .student-extra-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  .company-settings-hero__layout {
    flex-direction: column;
  }

  .company-settings-hero__meta {
    align-items: flex-start;
  }

  .company-settings-limit-list {
    justify-content: flex-start;
  }
}

.chat-window {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  border-radius: 1.25rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.chat-messages {
  flex: 1;
  padding: 1.2rem;
  overflow-y: auto;
}

.chat-message {
  max-width: 85%;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: var(--color-surface-elevated);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

.chat-loader {
  width: 100px;
  height: 40px;
  --g: radial-gradient(
      farthest-side,
      transparent calc(95% - 3px),
      #fff calc(100% - 3px) 98%,
      transparent 101%
    )
    no-repeat;
  background: var(--g), var(--g), var(--g);
  background-size: 30px 30px;
  animation: chat-loader-pulse 1s infinite alternate;
  margin: 0 auto;
  display: block;
}

.chat-bubble.typing-indicator {
  opacity: 0.9;
  background: rgba(82, 70, 86, 0.08);
}

.chat-bubble.typing-indicator .bubble-content {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 78px;
}

.chat-bubble.typing-indicator .chat-loader {
  width: 85%;
  max-width: 210px;
}

@keyframes chat-loader-pulse {
  0% {
    background-position: 0 50%, 50% 50%, 100% 50%;
  }
  20% {
    background-position: 0 0, 50% 50%, 100% 50%;
  }
  40% {
    background-position: 0 100%, 50% 0, 100% 50%;
  }
  60% {
    background-position: 0 50%, 50% 100%, 100% 0;
  }
  80% {
    background-position: 0 50%, 50% 50%, 100% 100%;
  }
  100% {
    background-position: 0 50%, 50% 50%, 100% 50%;
  }
}

.chat-message.agent {
  margin-left: auto;
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-text);
}

.chat-message.user {
  border-top-left-radius: 0.3rem;
}

.chat-footer {
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  background: var(--color-surface-elevated);
}

.chat-footer textarea {
  width: 100%;
  border-radius: 0.9rem;
  border: 1px solid var(--color-border);
  min-height: 110px;
  padding: 0.95rem 1.1rem;
  background: transparent;
  color: inherit;
}

.chat-footer textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  border-radius: 0.9rem;
  border: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  background: transparent;
  color: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.chatgpt-board {
  display: flex;
  min-height: calc(100vh - 150px);
  border-radius: 1.5rem;
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.chatgpt-sidebar {
  width: 320px;
  background: var(--color-surface-elevated);
  border-right: 1px solid var(--color-border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.chatgpt-sidebar__history {
  overflow-y: auto;
  max-height: calc(100vh - 260px);
  padding-right: 0.25rem;
}

.agent-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.history-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 0.75rem;
  background: var(--color-surface);
}

.history-item form {
  margin: 0;
}

.history-trash {
  border: none;
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.history-trash i {
  pointer-events: none;
}

.history-trash:hover,
.history-trash:focus-visible {
  background: #dc3545;
  color: #fff;
}

.history-time {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.history-preview {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
}

.chatgpt-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
}

.chatgpt-main__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.chat-stream {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--color-surface);
  scroll-behavior: smooth;
}

.chat-input {
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.5rem 1.5rem;
  background: var(--color-surface-elevated);
}

.chat-input textarea {
  width: 100%;
  min-height: 140px;
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  background: transparent;
  color: inherit;
  padding: 1rem 1.2rem;
  resize: vertical;
}

.chat-input__actions {
  margin-top: 0.75rem;
  text-align: right;
}

.chat-bubble {
  max-width: 820px;
  padding: 1rem 1.2rem;
  border-radius: 1.25rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.2rem;
}

.chat-bubble.agent {
  border-top-left-radius: 0.5rem;
}

.chat-bubble.user {
  margin-left: auto;
  background: linear-gradient(120deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  border: none;
}

.bubble-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
  color: var(--color-muted);
}

.chat-bubble.user .bubble-meta {
  color: rgba(255, 255, 255, 0.8);
}

.bubble-content {
  font-size: 1rem;
  word-break: break-word;
}

.chat-bubble.user .bubble-content {
  color: #fff;
}

.chat-bubble.agent .bubble-content {
  color: var(--color-text);
}

.chat-bubble.is-typing .bubble-content::after {
  content: "▋";
  display: inline-block;
  margin-left: 4px;
  animation: blink-cursor 0.8s steps(2, start) infinite;
  color: var(--brand-primary);
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 3rem 0;
}

@keyframes blink-cursor {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 992px) {
  .chatgpt-board {
    flex-direction: column;
  }

  .chatgpt-main {
    order: 1;
  }

  .chatgpt-sidebar {
    order: 2;
  }

  .chatgpt-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: none;
    border-top: 1px solid var(--color-border);
    max-height: none;
  }

  .chatgpt-sidebar__history {
    max-height: 240px;
  }

  .history-header {
    align-items: flex-start;
  }
}

.status-pill {
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.status-pill.active {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.status-pill.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.dashboard-analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.period-switch,
.metric-switch {
  display: inline-flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0.28rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.period-chip,
.metric-chip {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  padding: 0.45rem 0.95rem;
  min-height: 36px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-chip:focus-visible,
.metric-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.26);
}

.period-chip:hover,
.metric-chip:hover {
  background: rgba(37, 99, 235, 0.12);
  color: var(--brand-primary);
  transform: translateY(-1px);
}

.period-chip.active,
.metric-chip.active {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.32);
}

.period-chip.active:hover,
.metric-chip.active:hover {
  color: #fff;
  transform: translateY(-1px);
}

.mini-metric-card {
  border: 1px solid var(--color-border);
  border-radius: 0.9rem;
  padding: 0.8rem 0.95rem;
  background: var(--color-surface-elevated);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mini-metric-label {
  color: var(--color-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mini-metric-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.mini-metric-value.small {
  font-size: 0.95rem;
  font-weight: 600;
}

.chart-panel {
  position: relative;
  min-height: 320px;
}

.chart-panel.chart-panel-sm {
  min-height: 260px;
}

.ranking-table th,
.ranking-table td {
  vertical-align: middle;
}

@media (max-width: 768px) {
  .app-content {
    padding: 1.5rem 0 3rem;
  }

  .metric-card,
  .app-card {
    padding: 1.25rem;
  }

  .chat-message {
    max-width: 100%;
  }

  .theme-toggle {
    display: none;
  }

  .app-navbar {
    padding-top: 0.55rem !important;
    padding-bottom: 0.55rem !important;
  }

  .app-navbar .container {
    align-items: center;
    gap: 0.5rem;
  }

  .app-navbar .navbar-brand {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 56px);
  }

  .app-navbar .navbar-collapse {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--color-border);
  }

  .app-navbar .navbar-nav {
    gap: 0.15rem !important;
  }

  .app-navbar .nav-link {
    padding: 0.55rem 0.2rem;
  }

  .app-navbar .navbar-collapse > .d-flex {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.6rem !important;
    margin-top: 0.35rem;
  }

  .app-navbar .navbar-collapse > .d-flex .dropdown,
  .app-navbar .navbar-collapse > .d-flex .btn {
    width: 100%;
  }

  .company-context-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .company-banner {
    height: clamp(240px, 84vw, 420px);
    border-radius: 14px;
  }

  .company-logo-wide {
    height: 34px;
    max-width: 160px;
  }

  .branding-current-file {
    align-items: flex-start;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.65rem;
  }

  .section-actions .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-header .btn-explore {
    width: 100%;
    min-height: 46px;
    padding: 0.65rem 1.2rem;
    font-weight: 600;
    background: var(--brand-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
  }

  .dashboard-header .btn-explore:hover {
    background: var(--brand-primary-dark);
    color: #fff;
  }

  .agent-list-item {
    flex-direction: column;
  }

  .agent-actions {
    width: 100%;
    text-align: left;
  }

  .agent-actions-row {
    width: 100%;
    justify-content: flex-start;
  }

  .agent-actions-row .btn {
    flex: 1 1 160px;
    justify-content: center;
  }

  .agent-form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .agent-form-actions__primary {
    flex-direction: column;
  }

  .agent-form-actions__primary .btn,
  .agent-form-actions__danger .btn {
    width: 100%;
    justify-content: center;
  }

  .agent-form-actions__danger {
    margin-left: 0;
  }

  .dashboard-analytics-header {
    flex-direction: column;
    align-items: stretch;
  }

  .period-switch,
  .metric-switch {
    width: 100%;
  }

  .period-chip,
  .metric-chip {
    flex: 1 1 auto;
    text-align: center;
    min-height: 40px;
    padding: 0.55rem 0.75rem;
  }

  .chart-panel {
    min-height: 260px;
  }

  .chart-panel.chart-panel-sm {
    min-height: 220px;
  }
}
