:root {
  --bg-app: #090d0b;
  --surface-1: #0f1713;
  --surface-2: #142019;
  --surface-3: #1a2a21;
  --text-primary: #e5f3ea;
  --text-secondary: #9db3a7;
  --accent: #2ec27e;
  --accent-hover: #43d790;
  --accent-soft: #23553d;
  --warn: #f1c40f;
  --danger: #ef5350;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 12% 15%, #163324 0%, transparent 40%),
    radial-gradient(circle at 85% 20%, #13261d 0%, transparent 36%), var(--bg-app);
  color: var(--text-primary);
  font-family: "IBM Plex Sans", sans-serif;
}

.app-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 1.25rem auto 2rem;
  position: relative;
  z-index: 2;
}

.card {
  border: 1px solid #1f2d25;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--surface-1), #0d1511);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

.hero {
  padding: 1.4rem 1.4rem 1rem;
  margin-bottom: 1rem;
}

.hero h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
}

.hero p {
  margin: 0.45rem 0 1rem;
  color: var(--text-secondary);
}

.search-row {
  display: flex;
  gap: 0.7rem;
  background: var(--surface-2);
  border: 1px solid #25382d;
  border-radius: 14px;
  padding: 0.65rem;
}

.search-row input {
  flex: 1;
  border: 1px solid #274534;
  background: var(--surface-3);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  font-size: 0.96rem;
}

.search-row input:focus {
  outline: 2px solid #2b7d57;
  outline-offset: 1px;
}

.search-row button {
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #05140d;
  font-weight: 700;
  padding: 0 1.1rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.search-row button:hover {
  background: var(--accent-hover);
}

.status {
  color: var(--text-secondary);
  margin-top: 0.8rem;
  min-height: 1.25rem;
}

.status.warn {
  color: var(--warn);
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--accent);
}

.dashboard {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
}

.metrics,
.insights {
  padding: 1.15rem;
}

.metrics h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.muted {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
}

.rating {
  margin: 0.75rem 0 1rem;
  font-weight: 700;
  font-size: 1.08rem;
}

.score-item {
  margin-bottom: 0.8rem;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 1px solid #25362c;
  border-radius: 12px;
}

.score-labels {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}

.progress-track {
  height: 12px;
  background: #203329;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #21a867, var(--accent));
  transition: width 240ms ease;
}

.badges {
  margin-top: 0.2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.badge {
  text-align: center;
  padding: 0.7rem 0.6rem;
  border-radius: 10px;
  font-weight: 600;
  border: 1px solid #2a3f33;
  background: var(--surface-2);
}

.badge.low,
.badge.a {
  color: var(--accent);
  border-color: #2e6a4c;
}

.badge.medium,
.badge.c {
  color: var(--warn);
  border-color: #6f641f;
}

.badge.high,
.badge.d {
  color: var(--danger);
  border-color: #6f2f2f;
}

.badge.b {
  color: #9de16e;
  border-color: #4d7541;
}

.insights h3 {
  margin: 0 0 0.85rem;
  font-family: "Space Grotesk", sans-serif;
}

.insights-box {
  background: var(--surface-2);
  border: 1px solid #274036;
  border-radius: 12px;
  padding: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.45;
  min-height: 350px;
  color: #d5e8dd;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.3;
  pointer-events: none;
}

.bg-orb-1 {
  width: 240px;
  height: 240px;
  background: #1e6f48;
  top: -70px;
  left: -40px;
}

.bg-orb-2 {
  width: 280px;
  height: 280px;
  background: #174430;
  right: -70px;
  top: 120px;
}

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

  .insights-box {
    min-height: 240px;
  }

  .search-row {
    flex-direction: column;
  }

  .search-row button {
    padding: 0.75rem 1rem;
  }
}

/* --- Bulk Mode Styles --- */
.mode-switcher {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  background: var(--surface-2);
  padding: 0.25rem;
  border-radius: 12px;
  width: fit-content;
}

.mode-switcher button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 500;
  transition: 0.2s;
}

.mode-switcher button.active {
  background: var(--surface-3);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hidden {
  display: none !important;
}

#bulkContainer {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

#bulkInput {
  width: 100%;
  height: 120px;
  background: var(--surface-3);
  border: 1px solid #274534;
  border-radius: 12px;
  color: var(--text-primary);
  padding: 0.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

#bulkInput:focus {
  outline: 2px solid #2b7d57;
  outline-offset: 1px;
}

.bulk-btn {
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #05140d;
  font-weight: 700;
  padding: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
}

.bulk-btn:hover {
  background: var(--accent-hover);
}

.bulk-results {
  margin-bottom: 1rem;
  padding: 1.25rem;
}

.bulk-results h3 {
  margin: 0 0 1rem;
  font-family: "Space Grotesk", sans-serif;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #1f2d25;
}

#resultsTable {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

#resultsTable th,
#resultsTable td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #1f2d25;
}

#resultsTable th {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

#resultsTable tr:last-child td {
  border-bottom: none;
}

#resultsTable tbody tr:hover {
  background: rgba(46, 194, 126, 0.04);
}

.table-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Agent City Styling */
.row-agent-city td {
  color: var(--accent);
  background: rgba(46, 194, 126, 0.08); /* slight green tint */
}
.row-agent-city:hover td {
  background: rgba(46, 194, 126, 0.15) !important;
}
.row-agent-city td strong {
  color: #5edb9c; 
}
