body {
  font-family: Arial, sans-serif;
  padding: 20px;
  background: #f4f4f4;
}
h1 {
  color: #333;
}
.call-entry {
  background: #fff;
  padding: 12px;
  margin-bottom: 10px;
  border-left: 5px solid #007bff;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
}
.call-entry strong {
  display: block;
  margin-bottom: 5px;
}

.agent-card {
  border: 1px solid #ccc;
  border-left: 5px solid #007bff;
  border-radius: 8px;
  padding: 10px 15px;
  margin: 10px 0;
  background: #f9f9f9;
  display: flex;
  flex-direction: column;
  font-family: sans-serif;
}

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.status-tag {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
}

.status-tag.available {
  background-color: #28a745;
}

.status-tag.busy {
  background-color: #c28033;
}

.status-tag.unavailable {
  background-color: #dc3545;
}

.status-tag.other {
  background-color: #6c757d;
}
.status-tag.ringing     { background-color: #0d6efd; }  /* blue */
.status-tag.no-answer   { background-color: #fd7e14; }  /* orange */
.status-tag.failed      { background-color: #dc3545; }  /* red */
.status-tag.completed   { background-color: #28a745; }  /* green */
.status-tag.machine     { background-color: #6c757d; }  /* gray */


.agent-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.agent-info > div {
  flex: 1 1 45%;
  margin-bottom: 5px;
}

/* Agent grid container */
#agentLog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* columns */
  gap: 12px;                          /* spacing between cards */
  max-width: 1100px;                  /* not full-screen */
  margin: 12px auto;                  /* center it */
  padding: 8px;
}

/* Card look */
.agent-card {
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

/* Header + status chip */
.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.status-tag {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eee;
}
.status-tag.available { background:#e7f7ec; color:#1b7f3b; }
.status-tag.busy      { background:#fff3e6; color:#b35a00; }
.status-tag.unavailable,
.status-tag.offline   { background:#fde7ea; color:#9b1c2c; }

/* Optional: prevent super-long state lists from blowing up a card */
.agent-info { word-break: break-word; }


/* Layout for the GHL log area (columns, not full width) */
#agentLogNew {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  max-width: 1100px;
  margin: 12px auto;
  padding: 8px;
}

/* Card styling + subtle blue accent for enrichment */
.ghl-card {
  background: #f0f9ff;
  border: 1px solid #dbeafe;
  border-left: 4px solid #3b82f6;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.ghl-card__title {
  font-weight: 600;
  margin-bottom: 8px;
}
.ghl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* two columns */
  gap: 6px 16px;
}
@media (max-width: 640px) {
  .ghl-grid { grid-template-columns: 1fr; } /* stack on small screens */
}


#dialLog { max-width: 1100px; margin:12px auto; }
.dial-line { padding:8px 10px; border-left:4px solid #10b981; background:#f8fffb; margin:6px 0; border:1px solid #e5e7eb; border-radius:8px; }


/* Phase 2 grid: columns, not full width */
#phase2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); /* columns */
  gap: 12px;
  max-width: 1100px;        /* keep it from stretching full screen */
  margin: 12px auto;
  padding: 8px;
}

/* Purple card look */
.phase2-card {
  background: #f6f4ff;
  border: 1px solid #e8e5ff;
  border-left: 4px solid #6b5cff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.phase2-title {
  font-weight: 600;
  margin-bottom: 8px;
}

/* two-column details inside each card (optional) */
.phase2-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}
@media (max-width: 640px) {
  .phase2-grid { grid-template-columns: 1fr; }
}


.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin: 10px 0 6px;
}
.kpi {
  background: #0c1222;
  border: 1px solid #1e2942;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  color: #e6f0ff;
}
.kpi-val { font-size: 24px; font-weight: 700; }
.kpi-label { font-size: 12px; opacity: .8; }

.panel {
  background: #0b0f1a;
  border: 1px solid #1f2a44;
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  color: #d7e3ff;
}

.assignment-card {
  border-left: 4px solid #2dd4bf;
  background: #051e22;
  color: #d6fffb;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.assignment-card .line { margin: 2px 0; }
.assignment-card .meta { font-size: 12px; opacity: .85; }
.assignment-card .agent-tag {
  background: #1a2a44;
  color: #9ff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  margin-left: 6px;
}
.assignment-card a { color: #9ff; text-decoration: underline; }


  #agentSearch {
    width: 100%;
    max-width: 520px;
    padding: 10px 12px;
    margin: 10px 0 14px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    font-size: 14px;
  }

  #agentGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
  }

  .agent-card {
    border: 1px solid #e5e7eb;
    border-left: 4px solid #9ca3af; /* default */
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  }

  .agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
  }
  .agent-title { display:flex; gap:8px; align-items:center; }
  .status-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e5e7eb; color: #111827;
  }

  /* light color coding */
  .status-available  { border-left-color:#10b981; }
  .status-ringing    { border-left-color:#f59e0b; }
  .status-answered   { border-left-color:#3b82f6; }
  .status-on-call    { border-left-color:#2563eb; }
  .status-completed  { border-left-color:#64748b; }
  .status-busy       { border-left-color:#ef4444; }
  .status-offline    { border-left-color:#9ca3af; }
  .status-unknown    { border-left-color:#9ca3af; }

  .agent-info .row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px;
    padding: 3px 0;
  }
  .agent-info .row span:first-child { color:#6b7280; }

.auth-banner { background:#ffe9e9; color:#a00; padding:10px; border:1px solid #f5b0b0; border-radius:8px; margin:10px 0; }
.auth-banner.hidden { display:none; }
.auth-banner.show { display:block; }
.dimmed { opacity:0.45; pointer-events:none; filter: grayscale(0.2); }


:root{
  --bg:#f7f8fb;
  --card:#ffffff;
  --ink:#111;
  --muted:#666;
  --line:#e8e8ec;
  --accent:#111; /* tweak if you want a brand color */
  --radius:12px;
  --shadow:0 1px 2px rgba(0,0,0,.05);
}

body{ background:var(--bg); color:var(--ink); }

#agentLayout{
  max-width: 1280px;
  margin: 12px auto;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr; /* left fixed-ish, right flexible */
  gap: 16px;
  align-items: start;
}

#agentLeft{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#agentRight{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  min-height: 520px; /* just so it doesn’t collapse if GHL is slow to load */
}

/* Optional: keep dialpad visible while scrolling long left content */
@media (min-width: 900px){
  #agentRight{ position: sticky; top: 12px; }
}

/* Auth banner */
.auth-banner{
  background: #fff4f4;
  border: 1px solid #ffd7d7;
  color: #a00;
  border-radius: var(--radius);
  padding: 10px 12px;
}
.auth-banner.hidden{ display:none; }
.auth-banner.show{ display:block; }

/* Dim the content when logged out */
.dimmed{ opacity: .45; pointer-events: none; filter: grayscale(0.1); }

/* Cards / content container look (if you use simple divs) */
#agentContent > .card,
#agentContent > div{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

/* Controls */
#agentControls{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

#agentControls button,
#logoutBtn{
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .02s ease, box-shadow .12s ease, border-color .12s ease;
}
#agentControls button:hover,
#logoutBtn:hover{ border-color:#cfcfd6; box-shadow:0 1px 4px rgba(0,0,0,.06); }
#agentControls button:active,
#logoutBtn:active{ transform: translateY(1px); }

/* Suggest a primary look for Available */
#btn-available{
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Tiny “who” label */
#who{ color: var(--muted); margin: 4px 2px 0; }

/* Dialpad mount (visual frame only; remove if your GHL injects its own) */
#dialpadMount{
  min-height: 500px;
  border: 1px dashed #d9d9df;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

/* Responsive: stack on small screens */
@media (max-width: 899px){
  #agentLayout{ grid-template-columns: 1fr; }
  #agentRight{ position: static; min-height: 420px; }
}


/* if you want a little badge look somewhere */
.reason-missed { color:#a00; font-weight:600; }


