/* Helios agent panel, Lagoon design. Loaded after style.css; uses only its
   tokens, so light and dark ("night lagoon") both work. */

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ag-spacer { flex: 1; }

/* button.danger in style.css puts white text on --bad, which is too light in
   the dark theme; --accent-text is white in light and deep teal in dark. */
.agent-panel button.danger { color: var(--accent-text); }
button.warn { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
button.warn:hover { background: var(--warn-soft); border-color: var(--warn); }

/* ---------- header ---------- */
.ag-head { padding: 8px 8px 8px 18px; gap: 14px; }
.ag-head h1 { font-size: 20px; }
.ag-head .brand-mark { width: 34px; height: 34px; }
.ag-state { padding: 8px 16px; font-size: 15px; gap: 8px; }
#timer { font-variant-numeric: tabular-nums; }
#timer:not(:empty)::before { content: "·"; font-family: var(--font); margin-right: 6px; }
.agent-panel input.mono::placeholder { font-family: var(--font); }
.ag-phone:empty { display: none; }
.ag-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ag-stats { font-size: 15px; margin-right: 6px; }
.ag-stats .mono { color: var(--text); }
.ag-pause { display: inline-flex; gap: 6px; align-items: center; }
.ag-pause select { width: auto; min-height: 44px; padding: 8px 14px; border-radius: var(--pill); font-size: 15px; font-weight: 700; }
.ag-head button.ghost { color: var(--text); }
.ag-head button.ghost:hover { background: var(--panel-2); }

/* ---------- sign-in and change PIN ---------- */
.ag-main { align-content: start; }
.auth-card h2 { margin: 18px 0 4px; }
.auth-card .ag-inset { margin-top: 12px; }
.auth-card .ag-inset label:first-child { margin-top: 0; }
.ag-wide { width: 100%; min-height: 50px; font-size: 16px; }
.ag-check {
  display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 10px 0 0;
  font-weight: 700; cursor: pointer;
}
.ag-check input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.ag-pincard { max-width: 560px; width: 100%; justify-self: center; }
.ag-pincard h2 { margin-bottom: 4px; }
.ag-pinfields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }

/* ---------- work area: two columns, one on small screens ---------- */
.ag-work { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.ag-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ag-coaching { grid-column: 1 / -1; }
.ag-actions { margin-top: 16px; }

/* ---------- current call ---------- */
.ag-empty { display: flex; align-items: center; gap: 12px; padding: 22px 4px; color: var(--muted); font-size: 17px; font-weight: 800; }
.ag-wait { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; animation: ag-pulse 1.6s ease-in-out infinite; }
@keyframes ag-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 8px var(--accent-soft); } }
.ag-who { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ag-avatar {
  width: 60px; height: 60px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--coral-soft); color: var(--coral-text); font-size: 22px; font-weight: 900;
}
.ag-whotext { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.ag-name { font-size: 30px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.ag-name.mono { font-size: 26px; font-weight: 500; }
.ag-callsub { font-size: 15px; color: var(--muted); }
.ag-callsub > span:empty { display: none; }
.ag-callsub > span:not(:empty) + span:not(:empty)::before { content: " · "; }
.ag-crm {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; border-radius: var(--pill);
  background: var(--accent-soft); color: var(--accent-strong); font-size: 14.5px; font-weight: 800; text-decoration: none;
}
.ag-crm:hover { color: var(--accent-strong); filter: brightness(0.97); }
.ag-fields { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.ag-field {
  display: inline-flex; gap: 6px; align-items: baseline; padding: 8px 14px; border-radius: var(--pill);
  background: var(--panel-2); font-size: 14.5px; max-width: 100%;
}
.ag-field dt { color: var(--muted); font-weight: 600; }
.ag-field dt::first-letter { text-transform: uppercase; }
.ag-field dd { margin: 0; font-weight: 800; overflow-wrap: anywhere; min-width: 0; }
.ag-call .ag-actions button { min-height: 48px; padding: 12px 22px; font-size: 16px; }
.ag-call .ag-actions button.danger { padding: 12px 26px; }

/* insets: transfer picker, consult phase, incoming transfer, sign-in fields */
.ag-inset {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius-md); background: var(--panel-2);
  display: grid; gap: 10px; min-width: 0;
}
.auth-card .ag-inset { display: block; }
.ag-inset.hidden { display: none; }
.ag-inset-title { font-size: 14px; font-weight: 800; }
.ag-xfer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ag-phase-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 800; }
.ag-phase { border: 2px solid var(--accent); }
.ag-incoming { border-color: var(--call); }
.ag-dtmf { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 14px; }
.ag-dtmf.hidden { display: none; }

/* ---------- wrap-up: "How did it go?" ---------- */
.ag-wrap h2 { font-size: 17px; }
.ag-dispos button { padding: 10px 18px; }
.ag-dispos button.dnc { color: var(--bad-text); border-color: color-mix(in srgb, var(--bad) 40%, var(--panel)); }
.ag-dispos button.dnc.sel { background: var(--bad); border-color: var(--bad); color: var(--accent-text); }
.ag-wrap textarea { resize: vertical; min-height: 64px; }
.ag-cbrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 16px; align-items: end; }
.ag-cbrow .ag-check { margin: 0; }

/* ---------- live assist ---------- */
.as-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.as-head h2 { margin: 0; font-size: 17px; }
#assistState { font-size: 13px; padding: 3px 12px; }
#assistState.as-on { background: var(--ok-soft); color: var(--ok-text); }
#assistState.as-off { background: var(--pause-soft); color: var(--pause-text); }
#assistNote:empty { display: none; }
#assistHints { display: grid; gap: 8px; margin-bottom: 14px; }
#assistHints:empty { display: none; }
#assistHints .hint { padding: 16px 18px; border-radius: 22px; display: grid; gap: 4px; }
#assistHints .hint-label::first-letter { text-transform: uppercase; }
#assistHints .hint-text { font-size: 17px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
#assistHints .hint + .hint { padding: 10px 16px; border-radius: var(--radius-md); }
#assistHints .hint + .hint .hint-text { font-size: 15px; font-weight: 600; }
#assistHints .hint.k-compliance { background: var(--warn-soft); }
#assistHints .hint.k-compliance .hint-label { color: var(--warn-text); }
#assistCheck { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; font-size: 16px; }
#assistCheck:empty { display: none; }
#assistCheck li { display: flex; gap: 10px; align-items: flex-start; }
#assistCheck li::before {
  content: "" / "to do"; flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  border: 2px solid var(--warn); display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900; line-height: 1;
}
#assistCheck li.done::before { content: "✓" / "done"; background: var(--ok); border-color: var(--ok); color: var(--panel); }
#assistLines {
  display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; overscroll-behavior: contain;
  font-size: 15.5px; line-height: 1.45; padding: 2px; border-radius: var(--radius-sm);
}
#assistLines .ln { max-width: 85%; padding: 10px 14px; overflow-wrap: anywhere; }
#assistLines .ln.customer { align-self: flex-start; background: var(--pause-soft); border-radius: 18px 18px 18px 6px; }
#assistLines .ln.agent { align-self: flex-end; background: var(--accent-soft); border-radius: 18px 18px 6px 18px; }
#assistLines .ln.other { align-self: center; padding: 2px 8px; color: var(--muted); font-size: 13.5px; font-style: italic; }
.as-foot { margin: 12px 0 0; font-size: 13px; }

/* ---------- start a call, callbacks ---------- */
.ag-dial label:first-of-type { margin-top: 0; }
.ag-dial label { margin-top: 14px; }
.ag-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.ag-cblist { list-style: none; margin: 0; padding: 0; }
.ag-cblist li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.ag-cblist li:last-child { border-bottom: 0; }
.ag-cbwhen { flex: 0 0 auto; padding: 4px 10px; border-radius: var(--pill); background: var(--panel-2); font-size: 13px; white-space: nowrap; }
.ag-cbwho { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }

/* ---------- my coaching (player styles come from coaching-player.js) ---------- */
#coachingCard .cx-new { margin-left: 6px; color: var(--accent-text); }
.ag-ack { margin-top: 12px; }
.ag-reply { color: var(--text); margin-top: 4px; }
.ag-revnote { color: var(--text); }

/* ---------- small screens ---------- */
@media (max-width: 800px) {
  .ag-work { grid-template-columns: minmax(0, 1fr); }
  .ag-col { display: contents; }
  #callCard { order: 1; } #assistCard { order: 2; } #wrapCard { order: 3; }
  .ag-dial { order: 4; } .ag-callbacks { order: 5; } #coachingCard { order: 6; }
  /* During wrap-up the outcome comes straight after the call. */
  .ag-work:has(#wrapForm:not(.hidden)) #wrapCard { order: 2; }
  .ag-work:has(#wrapForm:not(.hidden)) #assistCard { order: 3; }
}
@media (max-width: 640px) {
  .ag-head { padding: 8px 10px 10px 14px; gap: 10px; }
  .ag-head .ag-spacer { display: none; }
  .ag-top { flex: 1 1 100%; justify-content: flex-start; }
  .ag-stats { flex: 1 1 100%; }
  .ag-top > button, .ag-pause { flex: 1 1 auto; }
  .ag-pause button { flex: 1 1 auto; }
  .ag-name { font-size: 24px; }
  .ag-avatar { width: 52px; height: 52px; font-size: 19px; }
}
@media (max-width: 520px) {
  .ag-xfer, .ag-pinfields, .ag-cbrow { grid-template-columns: minmax(0, 1fr); }
  .ag-cbrow .ag-check { margin-top: 10px; }
  .ag-call .ag-actions button { flex: 1 1 auto; }
  #assistLines .ln { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { .ag-wait { animation: none; } }
