:root {
  --bg-color: #ffffff;
  --text-color: #37352f;
  --text-color-secondary: #787774;
  --hover-bg: rgba(55, 53, 47, 0.08);
  --border-color: rgba(55, 53, 47, 0.16);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  line-height: 1.5;
  padding: 40px;
  display: flex;
  justify-content: center;
}

#app {
  max-width: 1000px;
  width: 100%;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
  color: var(--text-color);
}

.team-section {
  margin-bottom: 2rem;
}

.team-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.agent-row {
  display: grid;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(55, 53, 47, 0.05);
  transition: background 0.1s;
}

.agent-row:hover {
  background-color: var(--hover-bg);
}

.agent-name {
  font-weight: 400;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
  width: 100%;
  padding: 4px;
  text-align: right;
  border-bottom: 1px solid transparent;
}

.agent-input:focus {
  outline: none;
  border-bottom: 1px solid var(--text-color);
}

.agent-input::placeholder {
  color: var(--text-color-secondary);
  opacity: 0.5;
}

.delete-btn, .transfer-dropdown {
  color: var(--text-color-secondary);
  opacity: 0;
  cursor: pointer;
  text-align: center;
  font-size: 0.8rem;
  transition: opacity 0.2s;
  border: none;
  background: transparent;
  font-family: inherit;
}

.agent-row:hover .delete-btn, .agent-row:hover .transfer-dropdown {
  opacity: 1;
}

.delete-btn:hover, .transfer-dropdown:hover {
  color: var(--text-color);
}


.submit-btn {
  margin-top: 2rem;
  padding: 4px 0;
  background: transparent;
  border: none;
  color: var(--text-color-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.2s;
}

.submit-btn:hover {
  color: var(--text-color);
}

.tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 2rem;
}

.tab {
  cursor: pointer;
  color: var(--text-color-secondary);
  font-weight: 500;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--text-color);
  border-bottom-color: var(--text-color);
}

/* ========================================= */
/* Mobile Responsiveness                     */
/* ========================================= */
@media screen and (max-width: 768px) {
  body {
    padding: 15px;
  }

  #portal-title {
    font-size: 1.2rem;
  }

  /* Make tabs scrollable horizontally on small screens */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    gap: 15px;
  }

  .tab {
    white-space: nowrap;
    font-size: 0.9rem;
  }

  /* Ensure the grid table scrolls nicely */
  #agents-container {
    margin-right: -15px;
    padding-right: 15px;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  /* Fix disappearing names: force a min-width and make it sticky */
  .team-header > div:first-child,
  .agent-row > div:first-child,
  .agent-name {
    min-width: 110px;
    position: sticky;
    left: 0;
    background: var(--bg-color); /* solid white so text doesn't overlap */
    z-index: 5;
    box-shadow: 2px 0 4px rgba(0,0,0,0.03); /* subtle shadow to show depth */
    font-size: 0.85rem;
  }

  .agent-input {
    font-size: 0.9rem;
  }

  /* Action buttons (delete, transfer) need to be always visible on mobile since there is no hover */
  .delete-btn, .transfer-dropdown {
    opacity: 1;
    font-size: 0.75rem;
  }

  /* Make bottom buttons wrap if space is tight */
  #app > div:last-child {
    flex-wrap: wrap;
    gap: 15px !important;
  }

  /* Notification panel tweaks for mobile */
  #notification-panel {
    width: 280px !important;
    right: 15px !important;
    top: 70px !important;
  }
}
