.app-bg {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(13, 202, 240, 0.2), transparent 60%),
    radial-gradient(800px 420px at 85% 0%, rgba(25, 135, 84, 0.2), transparent 60%),
    #0b1020;
}

.card {
  background: #121a2c;
  border: 1px solid #24304a !important;
}

.form-control,
.form-select {
  background: #0f1729;
  border-color: #2c3a59;
  color: #dbe6ff;
}

.form-control:focus,
.form-select:focus {
  background: #0f1729;
  color: #e7efff;
  border-color: #4f7cff;
  box-shadow: 0 0 0 0.2rem rgba(79, 124, 255, 0.2);
}

.btn-primary {
  background: #3b66ff;
  border-color: #3b66ff;
}

.btn-primary:hover {
  background: #3156d5;
  border-color: #3156d5;
}

.btn-outline-primary {
  border-color: #4f7cff;
  color: #8aa7ff;
}

.btn-outline-primary:hover {
  background: #4f7cff;
  color: #081126;
}

.actions .btn {
  min-width: 0;
}

.status {
  min-height: 24px;
}

.response-box {
  background: #0f1729;
  border: 1px solid #2c3a59;
  border-radius: 0.6rem;
  padding: 0.85rem;
  min-height: 84px;
  margin: 0;
  color: #dbe6ff;
  white-space: pre-wrap;
  word-break: break-word;
}

.history {
  display: grid;
  gap: 0.75rem;
}

.history-item {
  border: 1px solid #2c3a59;
  border-radius: 0.6rem;
  padding: 0.8rem;
  background: #0f1729;
}

.history-item .meta {
  font-size: 0.78rem;
  color: #8ba0c7;
}

.history-meta-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.history-meta-line .badge {
  font-size: 0.72rem;
}

.dot-sep {
  opacity: 0.7;
  margin: 0 0.2rem;
}

.history-metrics .badge {
  font-weight: 500;
}

.history-usage-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-reuse-btn {
  line-height: 1;
}

.history-chars-row .meta {
  white-space: nowrap;
}

.history-chars-row .usage-inline-badges .badge {
  font-size: 0.72rem;
}

.history-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.history-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 20, 0.75);
}

.history-modal-panel {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  max-height: 85vh;
  overflow: auto;
  background: #0f1729;
  border: 1px solid #2c3a59;
  border-radius: 0.7rem;
  padding: 1rem;
}

.history-details-content {
  background: #0b1020;
  border: 1px solid #2c3a59;
  border-radius: 0.55rem;
  padding: 0.8rem;
  color: #dbe6ff;
  min-height: 110px;
  max-height: 220px;
  overflow: auto;
  resize: vertical;
}

.history-details-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.35rem 0.75rem;
}

.stats-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.history-tabs {
  border-bottom-color: #2c3a59;
}

.history-tabs .nav-link {
  color: #9fb0ce;
  border-color: transparent;
}

.history-tabs .nav-link:hover {
  border-color: #2c3a59 #2c3a59 #2c3a59;
  color: #dbe6ff;
}

.history-tabs .nav-link.active {
  background: #0f1729;
  border-color: #2c3a59 #2c3a59 #0f1729;
  color: #dbe6ff;
}

.meta-label {
  color: #8ba0c7;
  font-size: 0.85rem;
}

.meta-value {
  color: #dbe6ff;
  font-size: 0.92rem;
  word-break: break-word;
}

@media (max-width: 900px) {
  .stats-layout {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none;
}

.cost-badge {
  background: #ff9800;
  color: #271700;
}

.token-badge {
  background: #2e7d32;
  color: #ecffef;
}

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

.usage-card {
  border: 1px solid #2c3a59;
  border-radius: 0.7rem;
  background: #0b1020;
  padding: 0.7rem;
}

.usage-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #dbe6ff;
}

.usage-card-full {
  grid-column: 1 / -1;
}

.usage-inline-badges {
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
}

.usage-grid-compact {
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.usage-grid-compact .usage-card {
  padding: 0.6rem;
}

.usage-grid-compact .usage-card-title {
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.history-usage-grid.usage-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.response-token-badge {
  background: #ff9800;
  color: #271700;
}

.response-cost-badge {
  background: #2e7d32;
  color: #ecffef;
}

.response-time-badge {
  background: #3b66ff;
  color: #e9efff;
}

@media (max-width: 576px) {
  .usage-card .badge {
    font-size: 0.78rem;
  }
}

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

@media (min-width: 1200px) {
  .sidebar-card {
    position: sticky;
    top: 1rem;
  }
}
