:root {
  color-scheme: light;
  --bg: #f5f7ff;
  --bg-accent: #eef2ff;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text-primary: #101828;
  --text-muted: #475467;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #e0e7ff;
  --success: #067647;
  --danger: #b42318;
  --border: #d0d5dd;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 18px 44px rgba(79, 70, 229, 0.16);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --transition: 180ms ease;
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, #e0e7ff 0%, transparent 36%),
    radial-gradient(circle at 90% 20%, #dbeafe 0%, transparent 35%),
    linear-gradient(165deg, var(--bg) 0%, var(--bg-accent) 100%);
  color: var(--text-primary);
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 2rem auto;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
}

.hero {
  background:
    linear-gradient(135deg, rgba(79, 70, 229, 0.95), rgba(14, 116, 144, 0.9)),
    var(--surface);
  color: #ffffff;
  box-shadow: var(--shadow-strong);
}

.eyebrow {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.92;
}

.hero h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  line-height: 1.2;
}

.hero-subtitle {
  margin: 0.6rem 0 0;
  color: rgba(255, 255, 255, 0.92);
  max-width: 72ch;
}

.hero-chips {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.32);
  font-size: 0.82rem;
  font-weight: 600;
}

.section-heading {
  margin-bottom: 0.9rem;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  line-height: 1.2;
}

.section-heading p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.section-heading.compact {
  margin-bottom: 0.65rem;
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

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

.auth-pane {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  padding: 0.95rem;
}

.auth-pane h3 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.dashboard {
  display: grid;
  gap: 1rem;
}

#profileCard,
#onlinePanel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 250, 255, 0.96));
}

.profile-text {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.grid-form {
  display: grid;
  gap: 0.7rem;
}

label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
  color: #344054;
}

input,
textarea,
select,
button {
  font: inherit;
  border-radius: var(--radius-sm);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-primary);
  padding: 0.66rem 0.75rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  padding: 0.62rem 0.95rem;
  cursor: pointer;
  width: fit-content;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  box-shadow: 0 7px 16px rgba(79, 70, 229, 0.24);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--primary-dark), #4f46e5);
  box-shadow: 0 10px 18px rgba(79, 70, 229, 0.26);
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.26);
  outline-offset: 2px;
}

#logoutButton {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 8px 16px rgba(220, 38, 38, 0.24);
}

#refreshAgentsButton,
#refreshMyRequestsButton,
#refreshOpenRequestsButton,
#refreshAssignedRequestsButton {
  color: var(--primary-dark);
  background: var(--primary-soft);
  box-shadow: none;
}

#refreshAgentsButton:hover,
#refreshMyRequestsButton:hover,
#refreshOpenRequestsButton:hover,
#refreshAssignedRequestsButton:hover {
  background: #c7d2fe;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: #f8f9ff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

#agentAvailability {
  margin: 0;
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.hidden {
  display: none !important;
}

.status {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  border: 1px solid transparent;
  min-height: 2.8rem;
  display: flex;
  align-items: center;
}

.status:empty {
  display: none;
}

.status.success {
  color: var(--success);
  background: #ecfdf3;
  border-color: #abefc6;
}

.status.error {
  color: var(--danger);
  background: #fef3f2;
  border-color: #fecdca;
}

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

.empty-state {
  margin: 0;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px dashed #c7d2fe;
  background: #f8faff;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.list li {
  margin-bottom: 0.35rem;
}

.request-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.82rem;
  background: linear-gradient(180deg, #ffffff, #fcfcff);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.request-title {
  margin: 0;
  font-size: 1.02rem;
}

.request-meta {
  margin: 0.42rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.request-actions button {
  box-shadow: none;
}

@media (max-width: 900px) {
  .container {
    width: min(100%, calc(100% - 1rem));
    margin: 1rem auto;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading-row {
    flex-direction: column;
    align-items: flex-start;
  }

  button,
  #refreshAgentsButton,
  #refreshMyRequestsButton,
  #refreshOpenRequestsButton,
  #refreshAssignedRequestsButton,
  #logoutButton {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
