:root{
  --bg:#071521;
  --panel:#12212d;
  --panel2:#182936;
  --line:#2c3e4b;
  --text:#f4f7fa;
  --muted:#aeb8c1;
  --green:#35d07f;
  --red:#ff414c;
  --amber:#ffae28;
  --blue:#28a9ff;
}

*{ box-sizing:border-box; }

html,body{
  margin:0;
  min-height:100%;
  background:radial-gradient(circle at 45% 15%,#102736 0,#071521 48%,#04101a 100%);
  color:var(--text);
  font-family:Segoe UI,Arial,sans-serif;
}

body{ overflow-x:hidden; }

.page{
  padding:12px 14px 8px;
  min-width:1180px;
}

header{
  height:116px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--line);
  padding:0 14px 8px;
}

.brand,.statusbox{
  display:flex;
  align-items:center;
  gap:22px;
}

.gww{
  width:180px;
  height:92px;
  object-fit:contain;
}

.divider{
  width:1px;
  height:54px;
  background:#84919a;
}

h1{
  margin:0;
  font-size:36px;
  letter-spacing:1px;
}

.subtitle{
  margin-top:5px;
  color:#c8d0d7;
  font-size:14px;
}

.statusbox{
  text-align:right;
  font-size:15px;
}

.statusbox strong{ font-size:34px; }

.statusline{
  display:flex;
  align-items:center;
  gap:10px;
  white-space:nowrap;
}

.dot{
  width:26px;
  height:26px;
  border-radius:50%;
  display:inline-block;
}
.green{background:var(--green);} .red{background:var(--red);} .blue{background:var(--blue);}

.kpi-grid{
  display:grid;
  grid-template-columns:repeat(6, 1fr);
  gap:6px;
  margin-top:10px;
}

.summary-grid{
  display:grid;
  grid-template-columns:repeat(5, 1fr);
  gap:8px;
  margin-top:8px;
}

.kpi,.smallcard,.panel{
  background:linear-gradient(180deg,rgba(24,41,54,.96),rgba(12,27,38,.96));
  border:1px solid #314553;
  border-radius:8px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02);
}

.kpi{
  height:98px;
  text-align:center;
  padding:12px 6px;
}

.kpi label,.smallcard label{
  display:block;
  color:#c6cdd3;
  font-size:14px;
}

.kpi strong{
  display:block;
  margin-top:6px;
  font-size:42px;
}

.kpi .sub,.smallcard .sub{
  color:#b4bdc4;
  font-size:12px;
}

.kpi.available strong,.summarycard.available strong{ color:var(--green); }
.kpi.call strong,.summarycard.call strong{ color:var(--red); }
.kpi.warn strong,.summarycard.warn strong{ color:var(--amber); }

.smallcard{
  height:94px;
  text-align:center;
  padding:12px 6px;
}

.smallcard strong{
  display:block;
  margin-top:6px;
  font-size:38px;
}

.summarycard.sl-good{
  border-color:rgba(53,208,127,.75);
}
.summarycard.sl-good strong{ color:var(--green); }
.summarycard.sl-bad{
  border-color:rgba(255,65,76,.75);
}
.summarycard.sl-bad strong{ color:var(--red); }
.summarycard.sl-na strong{ color:var(--text); }

.middle-queue-agents{
  display:grid;
  grid-template-columns:minmax(0, 2fr) minmax(0, 1fr);
  gap:8px;
  margin-top:8px;
}

.panel{ padding:10px 12px; }

h2{
  margin:0 0 8px;
  font-size:16px;
}

table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

th{
  padding:7px 6px;
  background:#243746;
  color:#cbd3d9;
  text-align:center;
}

td{
  padding:7px 6px;
  border-bottom:1px solid #263a48;
  text-align:center;
}

th:first-child,td:first-child{ text-align:left; }
.slgood{ color:var(--green); font-weight:700; }
.slbad{ color:var(--red); font-weight:700; }

.tall-agent-panel{
  min-height:195px;
}

.tall-agent-list{
  display:grid !important;
  grid-template-columns:1fr;
  gap:6px;
  max-height:220px;
  overflow-y:auto;
  padding-right:2px;
}

.agentrow{
  width:100%;
  min-height:28px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:6px 8px;
  border:1px solid #2b4050;
  border-radius:6px;
  background:#102331;
}

.agentname{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:13px;
  font-weight:600;
  line-height:1.1;
}

.agentstatus{
  display:flex;
  align-items:center;
  gap:5px;
  white-space:nowrap;
  color:#d7e0e6;
  font-size:12px;
}

.agentdot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#9aa6ad;
  flex:0 0 8px;
}
.agentstatus.available .agentdot{background:#35d07f;}
.agentstatus.call .agentdot{background:#ff414c;}
.agentstatus.consult .agentdot{background:#ffae28;}
.agentstatus.wrapup .agentdot{background:#ffd35b;}
.agentstatus.notready .agentdot{background:#aab4bc;}
.agentstatus.other .agentdot{background:#28a9ff;}

.noagents{ color:#9aa6ad; padding:10px; }

.bottom.compact-bottom{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:8px;
  margin-top:8px;
}

.chartpanel,.agentpanel{ height:225px; }
.chartpanel canvas{ width:100% !important; height:178px !important; }

.agentcontent{
  display:flex;
  align-items:center;
  height:170px;
}

.agentcontent canvas{
  max-width:185px;
  max-height:165px;
}

.agentcontent > div{ flex:1; }

.legendrow{
  display:grid;
  grid-template-columns:20px 1fr 40px;
  align-items:center;
  gap:8px;
  margin:6px 0;
  font-size:12px;
}

.legenddot{
  width:11px;
  height:11px;
  border-radius:50%;
}

footer{
  display:flex;
  justify-content:space-between;
  padding:8px 4px 0;
  color:#8997a1;
  font-size:10px;
}

.fsc{ letter-spacing:3px; }
.fsc b{ color:#e3002b; letter-spacing:2px; }

.agentlistpanel{ display:none !important; }

@media(max-width:1500px){
  .middle-queue-agents{ grid-template-columns:minmax(0, 2fr) minmax(0, 1fr); }
  .kpi strong{ font-size:40px; }
  .smallcard strong{ font-size:36px; }
}

@media(max-width:1400px){
  .middle-queue-agents{ grid-template-columns:minmax(0, 2fr) minmax(0, 1fr); }
  .kpi strong{ font-size:38px; }
  .smallcard strong{ font-size:34px; }
}

@media(max-height:900px){
  header{ height:102px; }
  .gww{ width:160px; height:80px; }
  h1{ font-size:32px; }
  .kpi{ height:92px; }
  .kpi strong{ font-size:38px; }
  .smallcard{ height:88px; }
  .smallcard strong{ font-size:34px; }
  .tall-agent-panel{ min-height:182px; }
  .tall-agent-list{ max-height:205px; }
  .agentrow{ min-height:26px; padding:5px 7px; }
  .agentname{ font-size:12px; }
  .agentstatus{ font-size:11px; }
  .chartpanel,.agentpanel{ height:205px; }
  .chartpanel canvas{ height:158px !important; }
  .agentcontent{ height:150px; }
  .agentcontent canvas{ max-width:165px; max-height:145px; }
}


/* ===== V16 2/3 Queue Summary + 1/3 Logged-In Agents ===== */
.middle-queue-agents{
  grid-template-columns:minmax(0,2fr) minmax(0,1fr);
}

.tall-agent-list{
  grid-template-columns:repeat(2,minmax(0,1fr));
}

/* If only one agent is logged in, let the card span the panel width */
.tall-agent-list .agentrow:only-child{
  grid-column:1 / -1;
}

@media(max-width:1400px){
  .middle-queue-agents{
    grid-template-columns:minmax(0,2fr) minmax(0,1fr);
  }
}


/* ===== V17 MATCH BOTTOM ROW TO 2/3 + 1/3 ===== */
.bottom.compact-bottom{
  grid-template-columns:minmax(0,2fr) minmax(0,1fr);
}

@media(max-width:1500px){
  .bottom.compact-bottom{
    grid-template-columns:minmax(0,2fr) minmax(0,1fr);
  }
}

@media(max-width:1400px){
  .bottom.compact-bottom{
    grid-template-columns:minmax(0,2fr) minmax(0,1fr);
  }
}


/* ===== V18 ENSURE UP TO 7 LOGGED-IN AGENTS FIT ===== */

/* Two-column agent grid: 7 agents = 4 rows */
.tall-agent-list{
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px 8px;
  max-height:220px;
  overflow-y:auto;
}

/* One agent uses the full width */
.tall-agent-list .agentrow:only-child{
  grid-column:1 / -1;
}

/* Compact agent cards enough for 7 visible entries */
.tall-agent-list .agentrow{
  min-height:30px;
  padding:6px 8px;
}

.tall-agent-list .agentname{
  font-size:12px;
}

.tall-agent-list .agentstatus{
  font-size:10px;
}

/* Slightly taller agent panel to comfortably fit 4 rows */
.tall-agent-panel{
  min-height:205px;
}

@media(max-height:900px){
  .tall-agent-panel{
    min-height:195px;
  }

  .tall-agent-list{
    max-height:190px;
    gap:5px 7px;
  }

  .tall-agent-list .agentrow{
    min-height:27px;
    padding:5px 7px;
  }

  .tall-agent-list .agentname{
    font-size:11px;
  }

  .tall-agent-list .agentstatus{
    font-size:9px;
  }
}


/* ===== V19 SERVICE LEVEL CARD VISIBILITY FIX ===== */

/* Give the second KPI row enough vertical room for value + target text */
.summary-grid{
  align-items:stretch;
}

.summarycard{
  height:104px;
  padding:10px 6px 8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  overflow:visible;
}

.summarycard label{
  flex:0 0 auto;
  line-height:18px;
  margin-bottom:2px;
}

.summarycard strong{
  flex:0 0 auto;
  display:block;
  margin:2px 0 0;
  font-size:38px;
  line-height:42px;
}

.summarycard .sub{
  flex:0 0 auto;
  display:block;
  margin-top:1px;
  line-height:16px;
  min-height:16px;
  position:static;
}

/* Specifically protect the Service Level target text from clipping */
.summarycard.sl-good,
.summarycard.sl-bad,
.summarycard.sl-na{
  padding-bottom:7px;
}

/* Keep it readable on shorter wallboard screens */
@media(max-height:900px){
  .summarycard{
    height:98px;
    padding:8px 6px 6px;
  }

  .summarycard strong{
    font-size:35px;
    line-height:38px;
  }

  .summarycard .sub{
    font-size:11px;
    line-height:14px;
    min-height:14px;
  }
}


/* ===== V20 production / alerting additions ===== */
.summary-grid{
  grid-template-columns:repeat(6,1fr);
}

.dot.amber{ background:#ffae28; }

.threshold-amber{
  color:#ffae28 !important;
  border-color:rgba(255,174,40,.75) !important;
}
.threshold-amber strong{ color:#ffae28 !important; }

.threshold-red{
  color:#ff414c !important;
  border-color:rgba(255,65,76,.85) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02), 0 0 12px rgba(255,65,76,.10);
}
.threshold-red strong{ color:#ff414c !important; }

.info-blue{
  border-color:rgba(40,169,255,.75) !important;
}
.info-blue strong{ color:#28a9ff !important; }

@media(max-width:1400px){
  .summary-grid{ grid-template-columns:repeat(6,1fr); }
  .summarycard strong{ font-size:31px; }
  .summarycard label{ font-size:12px; }
}


/* ===== V21 CALLBACK PENDING THRESHOLDS =====
   0   = normal
   1-2 = amber
   3+  = red
*/
.summarycard.alert-amber{
  border-color:#ffae28;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02), 0 0 12px rgba(255,174,40,.12);
}
.summarycard.alert-amber strong{
  color:#ffae28;
}

.summarycard.alert-red{
  border-color:#ff414c;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02), 0 0 12px rgba(255,65,76,.12);
}
.summarycard.alert-red strong{
  color:#ff414c;
}
