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 {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #070b12;
  color: #e6edf7;
}

.agv-body {
  min-height: 100vh;
}

.agv-container {
  padding: 18px 18px 28px 18px;
}

.agv-busy-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 11, 18, 0.7);
  backdrop-filter: blur(4px);
  z-index: 3000;
}

.agv-busy-overlay.is-visible {
  display: flex;
}

.agv-busy-dialog {
  min-width: min(420px, 100%);
  max-width: 520px;
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(11, 18, 32, 0.95);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.agv-modal-shell {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--agv-border);
  background: var(--agv-editor-bg);
  color: var(--agv-text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}

.agv-modal-accent {
  height: 6px;
  background: #2563eb;
}

.agv-modal-accent.is-info {
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
}

.agv-modal-accent.is-success {
  background: linear-gradient(90deg, #059669, #10b981);
}

.agv-modal-accent.is-warning {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

.agv-modal-accent.is-danger {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}

.agv-modal-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 22px 8px 22px;
}

.agv-modal-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--agv-panel-soft);
  border: 1px solid var(--agv-border);
  font-size: 22px;
}

.agv-modal-copy {
  flex: 1;
}

.agv-modal-message {
  color: var(--agv-muted);
  line-height: 1.55;
}

.agv-doc-preview-frame {
  width: 100%;
  height: 75vh;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: #0b1220;
}

.agv-doc-preview-box {
  height: 75vh;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: #0b1220;
}

.agv-doc-preview-image {
  max-width: 100%;
  height: auto;
  display: block;
}

.agv-doc-ocr-card {
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px;
}

.agv-doc-ocr-pre {
  white-space: pre-wrap;
  color: rgba(255, 255, 255, 0.88);
}

.agv-page .table-responsive {
  border-radius: 16px;
}

.agv-page .card,
.agv-page .agv-table {
  border-radius: 16px;
}

.agv-busy-title {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 700;
}

.agv-busy-text {
  margin-top: 8px;
  color: rgba(230, 237, 247, 0.78);
}

.agv-topbar {
  background: rgba(7, 11, 18, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.agv-brand-badge {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.18), rgba(99, 102, 241, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #cfe9ff;
  font-weight: 700;
}

.agv-topbar .nav-link {
  color: rgba(230, 237, 247, 0.78);
  border-radius: 10px;
  padding: 10px 12px;
}

.agv-topbar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.agv-topbar .nav-link.disabled {
  opacity: 0.45;
}

.agv-topbar-right {
  gap: 10px;
}

.agv-search {
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  min-width: 360px;
}

.agv-search i {
  opacity: 0.8;
}

.agv-search .form-control {
  background: transparent;
  border: 0;
  color: #e6edf7;
  padding: 0;
  box-shadow: none;
}

.agv-search .form-control::placeholder {
  color: rgba(230, 237, 247, 0.55);
}

.agv-btn-gradient {
  background: linear-gradient(90deg, #2dd4bf, #6366f1);
  border: 0;
  color: #061019;
  font-weight: 600;
}

.agv-btn-gradient:hover {
  filter: brightness(1.03);
  color: #061019;
}

.agv-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.agv-tenant {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(230, 237, 247, 0.85);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agv-avatar-btn {
  padding: 6px 8px;
  border-radius: 12px;
}

.agv-avatar-circle {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e6edf7;
  font-weight: 700;
  font-size: 12px;
}

.agv-dropdown {
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #e6edf7;
}

.agv-page {
  padding-top: 8px;
}

.agv-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.agv-page-title {
  font-size: 18px;
  font-weight: 700;
}

.agv-page-subtitle {
  font-size: 13px;
  color: rgba(230, 237, 247, 0.65);
}

.agv-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.agv-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  min-width: 170px;
}

.agv-stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 212, 191, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.agv-stat-value {
  font-weight: 800;
  line-height: 1;
}

.agv-stat-label {
  font-size: 12px;
  color: rgba(230, 237, 247, 0.65);
}

.agv-kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.agv-kanban::-webkit-scrollbar {
  height: 10px;
}

.agv-kanban::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.agv-kanban-col {
  width: 330px;
  flex: 0 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  min-height: 74vh;
}

.agv-kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.agv-kanban-col-title {
  font-weight: 700;
  font-size: 13px;
}

.agv-kanban-col-meta {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: rgba(230, 237, 247, 0.75);
}

.agv-kanban-col-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agv-card {
  display: block;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(11, 18, 32, 0.60);
  text-decoration: none;
  color: inherit;
}

.agv-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(11, 18, 32, 0.78);
}

.agv-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.agv-card-number {
  font-size: 12px;
  color: rgba(230, 237, 247, 0.65);
}

.agv-card-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.agv-card-subtitle {
  font-size: 12px;
  color: rgba(230, 237, 247, 0.60);
  margin-bottom: 10px;
}

.agv-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agv-card-value {
  font-weight: 700;
  white-space: nowrap;
}

.agv-card-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 130px;
}

.agv-progress {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.agv-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2dd4bf, #6366f1);
}

.agv-progress-label {
  font-size: 12px;
  color: rgba(230, 237, 247, 0.70);
}

.agv-card-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: rgba(230, 237, 247, 0.60);
}

.agv-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  letter-spacing: 0.02em;
}

.agv-badge-danger {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
}

.agv-badge-warning {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.agv-badge-muted {
  color: rgba(230, 237, 247, 0.72);
}

.agv-demand {
  min-height: calc(100vh - 92px);
}

.agv-demand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.agv-demand-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agv-dot-sep {
  opacity: 0.5;
}

.agv-demand-title {
  margin-bottom: 12px;
}

.agv-demand-body {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  gap: 14px;
}

.agv-demand-sources,
.agv-demand-ai,
.agv-demand-editor {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  overflow: hidden;
  min-height: 70vh;
}

.agv-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.agv-panel-title {
  font-weight: 700;
  font-size: 13px;
}

.agv-source-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agv-source-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(11, 18, 32, 0.55);
  color: inherit;
}

.agv-source-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
}

.agv-source-item.is-active {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.08);
}

.agv-source-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.agv-source-body {
  flex: 1;
  text-align: left;
}

.agv-source-name {
  font-weight: 700;
  font-size: 12px;
}

.agv-source-meta {
  font-size: 11px;
  color: rgba(230, 237, 247, 0.60);
}

.agv-source-check {
  opacity: 0.7;
}

.agv-editor-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.agv-tab {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(230, 237, 247, 0.75);
  font-size: 12px;
  font-weight: 600;
}

.agv-tab.is-active {
  color: #061019;
  border-color: transparent;
  background: linear-gradient(90deg, #2dd4bf, #6366f1);
}

.agv-editor-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(99, 102, 241, 0.10);
  color: rgba(230, 237, 247, 0.85);
  font-size: 12px;
}

.agv-editor-surface {
  padding: 0 12px 12px 12px;
}

.agv-editor {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(11, 18, 32, 0.65);
  padding: 14px;
  min-height: 58vh;
  overflow: auto;
}

.agv-editor-text {
  width: 100%;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(230, 237, 247, 0.90);
}

.agv-editor-text:focus {
  outline: none;
}

.agv-md {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(230, 237, 247, 0.90);
}

.agv-ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.18), rgba(99, 102, 241, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.agv-chat {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  height: 44vh;
}

.agv-chat-msg {
  display: flex;
}

.agv-chat-msg.from-ai {
  justify-content: flex-start;
}

.agv-chat-msg.from-user {
  justify-content: flex-end;
}

.agv-chat-bubble {
  max-width: 92%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(11, 18, 32, 0.65);
  padding: 10px 12px;
}

.agv-chat-msg.from-user .agv-chat-bubble {
  background: rgba(45, 212, 191, 0.10);
  border-color: rgba(45, 212, 191, 0.28);
}

.agv-chat-text {
  font-size: 12.5px;
  color: rgba(230, 237, 247, 0.90);
  line-height: 1.5;
}

.agv-ai-actions {
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.agv-chat-input {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.agv-chat-input .form-control {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #e6edf7;
}

.agv-chat-input .form-control::placeholder {
  color: rgba(230, 237, 247, 0.55);
}

.agv-table {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.agv-auth {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  min-height: 100vh;
}

.agv-auth-hero {
  position: relative;
  background-image: url("/img/login-bg.jpg");
  background-size: cover;
  background-position: center;
}

.agv-auth-hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px 600px at 10% 20%, rgba(99, 102, 241, 0.25), transparent 60%),
              radial-gradient(1200px 600px at 20% 80%, rgba(45, 212, 191, 0.20), transparent 55%),
              linear-gradient(0deg, rgba(7, 11, 18, 0.72), rgba(7, 11, 18, 0.34));
}

.agv-auth-hero-content {
  position: relative;
  height: 100%;
  padding: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 720px;
}

.agv-auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  width: fit-content;
  font-size: 12px;
  color: rgba(230, 237, 247, 0.85);
}

.agv-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2dd4bf;
  box-shadow: 0 0 0 5px rgba(45, 212, 191, 0.14);
}

.agv-auth-title {
  margin-top: 18px;
  font-weight: 800;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.agv-text-accent {
  color: #7dd3fc;
}

.agv-auth-subtitle {
  margin-top: 12px;
  color: rgba(230, 237, 247, 0.72);
  max-width: 560px;
}

.agv-metric {
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
}

.agv-metric-value {
  font-weight: 800;
}

.agv-metric-label {
  font-size: 12px;
  color: rgba(230, 237, 247, 0.60);
}

.agv-auth-footer {
  margin-top: 26px;
}

.agv-auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px;
  background: radial-gradient(900px 600px at 50% 10%, rgba(99, 102, 241, 0.16), transparent 55%),
              linear-gradient(180deg, rgba(7, 11, 18, 0.94), rgba(7, 11, 18, 0.98));
}

.agv-auth-card {
  width: 100%;
  max-width: 420px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(11, 18, 32, 0.62);
  padding: 26px;
}

.agv-input .input-group-text {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(230, 237, 247, 0.80);
}

.agv-input .form-control {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #e6edf7;
}

.agv-input .form-control::placeholder {
  color: rgba(230, 237, 247, 0.55);
}

.agv-reveal {
  border-color: rgba(255, 255, 255, 0.10);
  color: rgba(230, 237, 247, 0.80);
}

.agv-link {
  color: #7dd3fc;
  text-decoration: none;
}

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

.agv-divider {
  position: relative;
  text-align: center;
}

.agv-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
}

.agv-divider span {
  position: relative;
  padding: 0 10px;
  background: rgba(11, 18, 32, 0.62);
  color: rgba(230, 237, 247, 0.55);
  font-size: 12px;
}

.agv-auth-bottom {
  position: absolute;
  bottom: 14px;
  right: 22px;
}

@media (max-width: 992px) {
  .agv-auth {
    grid-template-columns: 1fr;
  }

  .agv-topbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .agv-search {
    min-width: 100%;
    width: 100%;
    order: 3;
  }

  .agv-auth-hero-content {
    padding: 34px;
  }

  .agv-demand-body {
    grid-template-columns: 1fr;
  }

  .agv-page > .d-flex.align-items-center.justify-content-between,
  .agv-page > .d-flex.justify-content-between.align-items-center,
  .agv-page .agv-demand-top,
  .agv-page .agv-editor-toolbar {
    flex-direction: column;
    align-items: stretch !important;
  }

  .agv-page > .d-flex.align-items-center.justify-content-between > div:last-child,
  .agv-page > .d-flex.justify-content-between.align-items-center > div:last-child,
  .agv-page .agv-demand-top-right,
  .agv-page .agv-editor-toolbar > div:last-child {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .agv-page .d-flex.gap-2,
  .agv-page .d-flex.gap-3 {
    flex-wrap: wrap;
  }
}

:root {
  --agv-bg: #f8fafc;
  --agv-text: #0f172a;
  --agv-muted: rgba(15, 23, 42, 0.62);
  --agv-border: rgba(15, 23, 42, 0.12);
  --agv-panel: #ffffff;
  --agv-panel-soft: rgba(15, 23, 42, 0.03);
  --agv-panel-strong: rgba(15, 23, 42, 0.06);
  --agv-topbar-bg: rgba(248, 250, 252, 0.9);
  --agv-input-bg: rgba(15, 23, 42, 0.04);
  --agv-input-text: #0f172a;
  --agv-input-placeholder: rgba(15, 23, 42, 0.45);
  --agv-link: #2563eb;
  --agv-editor-bg: #ffffff;
  --agv-editor-text: #0f172a;
}

html[data-theme="dark"] {
  --agv-bg: #070b12;
  --agv-text: #e6edf7;
  --agv-muted: rgba(230, 237, 247, 0.65);
  --agv-border: rgba(255, 255, 255, 0.10);
  --agv-panel: rgba(255, 255, 255, 0.03);
  --agv-panel-soft: rgba(255, 255, 255, 0.04);
  --agv-panel-strong: rgba(11, 18, 32, 0.65);
  --agv-topbar-bg: rgba(7, 11, 18, 0.9);
  --agv-input-bg: rgba(255, 255, 255, 0.04);
  --agv-input-text: #e6edf7;
  --agv-input-placeholder: rgba(230, 237, 247, 0.55);
  --agv-link: #7dd3fc;
  --agv-editor-bg: rgba(11, 18, 32, 0.65);
  --agv-editor-text: rgba(230, 237, 247, 0.90);
}

body {
  background: var(--agv-bg);
  color: var(--agv-text);
}

.agv-topbar {
  background: var(--agv-topbar-bg);
  border-bottom: 1px solid var(--agv-border);
}

.agv-topbar .nav-link {
  color: var(--agv-muted);
}

.agv-topbar .nav-link:hover {
  color: var(--agv-text);
}

.agv-search {
  border: 1px solid var(--agv-border);
  background: var(--agv-panel-strong);
}

.agv-search .form-control {
  color: var(--agv-text);
}

.agv-search .form-control::placeholder {
  color: var(--agv-input-placeholder);
}

.agv-tenant {
  border: 1px solid var(--agv-border);
  background: var(--agv-panel-strong);
  color: var(--agv-muted);
}

.agv-dropdown {
  background: var(--agv-editor-bg);
  border: 1px solid var(--agv-border);
  color: var(--agv-text);
}

.agv-input {
  background: var(--agv-input-bg) !important;
  border: 1px solid var(--agv-border) !important;
  color: var(--agv-input-text) !important;
}

.agv-input::placeholder {
  color: var(--agv-input-placeholder) !important;
}

.agv-panel-soft {
  background: var(--agv-panel-soft);
  border: 1px solid var(--agv-border);
}

.agv-badge-success {
  color: #065f46;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.16);
}

html[data-theme="dark"] .agv-badge-success {
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
}

.agv-badge-warning {
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.18);
}

html[data-theme="dark"] .agv-badge-warning {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.agv-demand-v2 {
  min-height: calc(100vh - 92px);
}

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

.agv-demand-number {
  font-size: 12px;
  color: var(--agv-muted);
}

.agv-demand-name {
  font-weight: 800;
  font-size: 18px;
}

.agv-stepper {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--agv-border);
  background: var(--agv-panel);
  margin-bottom: 14px;
}

.agv-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--agv-border);
  background: var(--agv-panel-soft);
  overflow: hidden;
}

.agv-step:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

.agv-step.is-active {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.35);
}

.agv-step-index {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--agv-border);
  background: var(--agv-panel);
  flex: 0 0 auto;
}

.agv-step-title {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agv-step.tone-analysis .agv-step-index {
  border-color: rgba(16, 185, 129, 0.45);
}

.agv-step.tone-decision .agv-step-index {
  border-color: rgba(245, 158, 11, 0.55);
}

.agv-step.tone-finance .agv-step-index {
  border-color: rgba(168, 85, 247, 0.55);
}

.agv-demand-grid {
  display: grid;
  grid-template-columns: 280px 1fr 360px;
  gap: 14px;
}

.agv-demand-grid.is-sources-collapsed {
  grid-template-columns: 0 1fr 360px;
}

.agv-demand-grid.is-chat-collapsed {
  grid-template-columns: 280px 1fr 0;
}

.agv-demand-grid.is-sources-collapsed.is-chat-collapsed {
  grid-template-columns: 0 1fr 0;
}

.agv-sources-panel,
.agv-editor-panel,
.agv-chat-panel {
  border: 1px solid var(--agv-border);
  background: var(--agv-panel);
  border-radius: 16px;
  overflow: hidden;
  min-height: 70vh;
}

.agv-demand-grid.is-sources-collapsed .agv-sources-panel {
  width: 0;
  border: 0;
  overflow: hidden;
}

.agv-demand-grid.is-chat-collapsed .agv-chat-panel {
  width: 0;
  border: 0;
  overflow: hidden;
}

.agv-chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.35), rgba(99, 102, 241, 0.35));
  color: rgba(230, 237, 247, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

html[data-theme="light"] .agv-chat-fab {
  border-color: var(--agv-border);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.25), rgba(99, 102, 241, 0.25));
  color: var(--agv-text);
}

.agv-panel-header {
  border-bottom: 1px solid var(--agv-border);
}

.agv-source-item {
  border: 1px solid var(--agv-border);
  background: var(--agv-panel-soft);
}

.agv-source-icon {
  border: 1px solid var(--agv-border);
}

.agv-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--agv-border);
}

.agv-doc-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agv-doc-title {
  font-weight: 800;
}

.agv-editor {
  border: 1px solid var(--agv-border);
  background: var(--agv-editor-bg);
}

.agv-md {
  color: var(--agv-editor-text);
}

.agv-chat-bubble {
  border: 1px solid var(--agv-border);
  background: var(--agv-panel-strong);
}

html[data-theme="light"] .btn-outline-light {
  border-color: var(--agv-border);
  color: var(--agv-text);
}

html[data-theme="light"] .btn-outline-light:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--agv-text);
  background-color: rgba(37, 99, 235, 0.06);
}

html[data-theme="light"] .btn-outline-secondary {
  border-color: rgba(15, 23, 42, 0.18);
  color: var(--agv-text);
}

html[data-theme="light"] .btn-outline-secondary:hover,
html[data-theme="light"] .btn-outline-secondary:focus {
  border-color: rgba(37, 99, 235, 0.35);
  background-color: rgba(37, 99, 235, 0.06);
  color: var(--agv-text);
}

html[data-theme="light"] .btn-primary {
  background-color: #2563eb;
  border-color: #2563eb;
}

html[data-theme="light"] .btn-primary:hover,
html[data-theme="light"] .btn-primary:focus {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

html[data-theme="light"] .agv-stat,
html[data-theme="light"] .agv-kanban-col,
html[data-theme="light"] .agv-card,
html[data-theme="light"] .agv-table,
html[data-theme="light"] .agv-demand-sources,
html[data-theme="light"] .agv-demand-ai,
html[data-theme="light"] .agv-demand-editor {
  border-color: var(--agv-border) !important;
  background: var(--agv-panel) !important;
}

html[data-theme="light"] .agv-card:hover,
html[data-theme="light"] .agv-source-item:hover {
  border-color: rgba(37, 99, 235, 0.35) !important;
}

html[data-theme="light"] .agv-card-number,
html[data-theme="light"] .agv-card-subtitle,
html[data-theme="light"] .agv-card-meta,
html[data-theme="light"] .agv-page-subtitle,
html[data-theme="light"] .agv-stat-label {
  color: var(--agv-muted) !important;
}

html[data-theme="light"] .agv-progress {
  background: rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .agv-progress-bar {
  background: linear-gradient(90deg, #2563eb, #7c3aed) !important;
}

html[data-theme="light"] .agv-btn-gradient {
  background: linear-gradient(90deg, #2563eb, #4f46e5) !important;
  color: #ffffff !important;
}

html[data-theme="light"] .agv-btn-gradient:hover {
  color: #ffffff !important;
}

html[data-theme="light"] .bg-dark,
html[data-theme="light"] .bg-black {
  background-color: var(--agv-panel) !important;
  color: var(--agv-text) !important;
}

html[data-theme="light"] .card.bg-dark,
html[data-theme="light"] .card.bg-black,
html[data-theme="light"] .card.text-light {
  background-color: var(--agv-panel) !important;
  color: var(--agv-text) !important;
  border-color: var(--agv-border) !important;
}

html[data-theme="light"] .card.bg-dark .card-body,
html[data-theme="light"] .card.bg-black .card-body,
html[data-theme="light"] .card.text-light .card-body,
html[data-theme="light"] .card.bg-dark .card-header,
html[data-theme="light"] .card.bg-black .card-header,
html[data-theme="light"] .card.text-light .card-header {
  color: var(--agv-text) !important;
}

html[data-theme="light"] .text-light {
  color: var(--agv-text) !important;
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select,
html[data-theme="light"] .input-group-text {
  background-color: #ffffff;
  border-color: var(--agv-border);
  color: var(--agv-text);
}

html[data-theme="light"] .form-control::placeholder,
html[data-theme="light"] .form-select::placeholder {
  color: var(--agv-input-placeholder);
}

html[data-theme="light"] .input-group-text.bg-dark,
html[data-theme="light"] .form-control.bg-dark,
html[data-theme="light"] .form-select.bg-dark {
  background-color: var(--agv-input-bg) !important;
  border-color: var(--agv-border) !important;
  color: var(--agv-text) !important;
}

html[data-theme="light"] code,
html[data-theme="light"] pre {
  color: #1e3a8a;
}

html[data-theme="light"] .alert-light {
  background-color: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.12);
  color: var(--agv-text);
}

html[data-theme="light"] .alert-warning {
  color: #7c2d12;
  background-color: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.22);
}

html[data-theme="light"] .alert-success {
  color: #14532d;
  background-color: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.22);
}

html[data-theme="light"] .dropdown-menu-dark {
  background-color: var(--agv-panel) !important;
  border-color: var(--agv-border) !important;
}

html[data-theme="light"] .dropdown-menu-dark .dropdown-item {
  color: var(--agv-text) !important;
}

html[data-theme="light"] .dropdown-menu-dark .dropdown-item:hover,
html[data-theme="light"] .dropdown-menu-dark .dropdown-item:focus {
  background-color: rgba(37, 99, 235, 0.08) !important;
}

html[data-theme="light"] .agv-topbar .navbar-brand,
html[data-theme="light"] .agv-topbar .navbar-brand .fw-semibold,
html[data-theme="light"] .agv-topbar .text-muted,
html[data-theme="light"] .agv-panel-title,
html[data-theme="light"] .agv-doc-title,
html[data-theme="light"] .agv-source-name,
html[data-theme="light"] .agv-chat-text,
html[data-theme="light"] .agv-editor-banner,
html[data-theme="light"] .agv-busy-title,
html[data-theme="light"] .agv-modal-shell .modal-title,
html[data-theme="light"] .dropdown-header {
  color: var(--agv-text) !important;
}

html[data-theme="light"] .agv-busy-dialog {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
}

html[data-theme="light"] .agv-busy-overlay {
  background: rgba(15, 23, 42, 0.32);
}

html[data-theme="light"] .agv-busy-text,
html[data-theme="light"] .agv-source-meta,
html[data-theme="light"] .agv-modal-message,
html[data-theme="light"] .text-muted,
html[data-theme="light"] .small.text-muted,
html[data-theme="light"] .form-text {
  color: var(--agv-muted) !important;
}

html[data-theme="light"] .agv-avatar-circle {
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.18);
  color: #1e3a8a;
}

html[data-theme="light"] .agv-brand-badge {
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .agv-editor-text,
html[data-theme="light"] .agv-md {
  color: var(--agv-editor-text) !important;
}

html[data-theme="light"] .agv-auth-panel {
  background: linear-gradient(180deg, #eff6ff, #f8fafc);
}

html[data-theme="light"] .agv-auth-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .agv-auth-card h2,
html[data-theme="light"] .agv-auth-bottom,
html[data-theme="light"] .agv-auth-legal {
  color: var(--agv-text) !important;
}

html[data-theme="light"] .agv-reveal {
  border-color: var(--agv-border);
  color: var(--agv-text);
  background: #ffffff;
}

html[data-theme="light"] .agv-doc-preview-frame,
html[data-theme="light"] .agv-doc-preview-box {
  border-color: var(--agv-border);
  background: #f8fafc;
}

html[data-theme="light"] .agv-doc-ocr-card {
  border-color: var(--agv-border) !important;
}

html[data-theme="light"] .agv-doc-ocr-pre {
  color: var(--agv-text);
}

html[data-theme="light"] .table-dark {
  --bs-table-color: var(--agv-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--agv-border);
  --bs-table-striped-bg: rgba(15, 23, 42, 0.02);
  --bs-table-striped-color: var(--agv-text);
  --bs-table-hover-bg: rgba(37, 99, 235, 0.06);
  --bs-table-hover-color: var(--agv-text);
}

@media (max-width: 1200px) {
  .agv-demand-grid {
    grid-template-columns: 260px 1fr 320px;
  }
}

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

  .agv-container {
    padding: 14px 14px 22px 14px;
  }

  .agv-demand-grid {
    grid-template-columns: 1fr;
  }
  .agv-demand-grid.is-sources-collapsed {
    grid-template-columns: 1fr;
  }
  .agv-demand-grid.is-sources-collapsed .agv-sources-panel {
    display: none;
  }

  .agv-demand-grid.is-chat-collapsed .agv-chat-panel {
    display: none;
  }

  .agv-page .card-body {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .agv-container {
    padding: 12px 12px 20px 12px;
  }

  .agv-auth-panel {
    padding: 20px;
  }

  .agv-auth-card {
    padding: 20px;
  }

  .agv-auth-title {
    font-size: 32px;
  }

  .agv-page-title {
    font-size: 16px;
  }

  .agv-page-subtitle {
    font-size: 12px;
  }

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

  .agv-page .btn,
  .agv-page .btn-sm {
    white-space: normal;
  }

  .agv-page .table {
    font-size: 0.875rem;
  }

  .agv-page .table td,
  .agv-page .table th {
    white-space: nowrap;
  }

  .agv-doc-preview-frame,
  .agv-doc-preview-box {
    height: 58vh;
  }

  .agv-modal-body {
    padding: 18px 18px 6px 18px;
  }

  .agv-modal-icon {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    font-size: 20px;
  }
}

@media (max-width: 576px) {
  .agv-auth-hero-content {
    padding: 24px;
  }

  .agv-auth-title {
    font-size: 28px;
  }

  .agv-stepper {
    grid-template-columns: 1fr;
  }

  .agv-topbar-right {
    gap: 8px;
  }

  .agv-page .btn,
  .agv-page .btn-sm {
    width: 100%;
  }

  .agv-page .d-flex.gap-2 > .btn,
  .agv-page .d-flex.gap-3 > .btn,
  .agv-page .d-flex.gap-2 > form,
  .agv-page .d-flex.gap-3 > form {
    width: 100%;
  }

  .agv-page .d-flex.gap-2 > form .btn,
  .agv-page .d-flex.gap-3 > form .btn {
    width: 100%;
  }

  .agv-page .table-responsive {
    border-radius: 12px;
  }
}
