/* 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; }
/* skills the call needed (docs/SKILLS.md, "Inbound routing") */
.ag-skills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 0; color: var(--muted); font-size: 14px; font-weight: 700; }
.ag-skill {
  display: inline-flex; align-items: center; padding: 5px 12px; border-radius: var(--pill);
  background: var(--accent-soft); color: var(--accent-strong); font-size: 14px; font-weight: 800; max-width: 100%; overflow-wrap: anywhere;
}
.ag-skill.widened { background: var(--panel-2); color: var(--muted); font-weight: 700; }
.ag-skill.info { background: transparent; border: 1px dashed var(--border-strong); color: var(--text); font-weight: 600; }
/* a type not used to match agents (Source...): information only, muted */
.ag-skill.muted-type { background: var(--panel-2); color: var(--muted); font-weight: 600; }
.ag-skill.info.muted-type { background: transparent; }
.ag-myskills { margin: 0 0 4px; justify-content: center; }
.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; } }

/* ---------- inbound call offer (agent-offer.js, docs/INBOUND_OFFER.md) ---------- */
#callCard.ag-ringing #noCall { display: none; }
.ag-offer {
  border: 3px solid var(--accent); border-radius: var(--radius-md); background: var(--accent-soft);
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--focus);
}
.ag-offer.hidden { display: none; }
.ag-offer-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ag-offer-icon {
  position: relative; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px; line-height: 1;
  background: var(--accent); color: var(--accent-text);
  animation: ag-offer-ring 1.4s ease-out infinite;
}
.ag-offer-text { min-width: 0; }
.ag-offer-title { font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-strong); }
.ag-offer-num { font-size: 28px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; line-height: 1.2; }
.ag-offer-queue { font-size: 15px; font-weight: 800; color: var(--muted); overflow-wrap: anywhere; }
.ag-offer-time { margin-top: 12px; font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.ag-offer-bar { height: 6px; border-radius: var(--pill); background: var(--panel); margin-top: 6px; overflow: hidden; }
.ag-offer-fill { height: 100%; width: 100%; background: var(--accent); transform-origin: left center; transition: transform .25s linear; }
.ag-offer-actions { display: flex; gap: 12px; margin-top: 14px; }
.ag-offer-btn { flex: 1 1 0; min-height: 48px; font-size: 18px; font-weight: 900; }
.ag-offer-btn:disabled { opacity: .6; cursor: default; }
@keyframes ag-offer-ring {
  0% { box-shadow: 0 0 0 0 var(--accent); }
  70%, 100% { box-shadow: 0 0 0 16px transparent; }
}
.ag-offer.ag-still .ag-offer-icon { animation: none; }
.ag-offer.ag-still .ag-offer-fill { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .ag-offer-icon { animation: none; }
  .ag-offer-fill { transition: none; }
}
@media (max-width: 520px) {
  .ag-offer { padding: 14px; }
  .ag-offer-num { font-size: 24px; }
}


/* ---------- navigation: Work, History, Customers, My day, Help (agent-nav.js) ---------- */
.ag-shell { display: block; }
.ag-nav { display: none; }
.ag-callbar { display: none; }
.ag-view { display: none; }
body.has-nav .ag-shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 0 8px; max-width: none; margin: 0; padding: 0 20px; }
header.ag-head { max-width: none; margin-left: 20px; margin-right: 20px; }
body.has-nav .ag-shell > .ag-main { max-width: none; margin: 0; min-width: 0; }
.ag-nav { flex-direction: column; gap: 4px; padding: 20px 8px 20px 16px; position: sticky; top: 0; align-self: start; box-sizing: border-box; }
body.has-nav .ag-nav:not(.hidden) { display: flex; }
.ag-navbtn {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 16px;
  color: var(--text); font-weight: 800; font-size: 16px; text-decoration: none;
}
.ag-navbtn svg { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ag-navbtn:hover { background: var(--panel-2); color: var(--text); }
.ag-navbtn[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 900; }
.ag-navdot { position: absolute; top: 10px; left: 30px; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px var(--panel); }
.ag-navdot.hidden { display: none; }

/* Only the matching section is shown; Work (#workArea and the sign-in cards) hides for the others. */
main[data-view="history"] > :not(#viewHistory),
main[data-view="customers"] > :not(#viewCustomers),
main[data-view="day"] > :not(#viewDay),
main[data-view="help"] > :not(#viewHelp) { display: none !important; }
main[data-view="history"] > #viewHistory,
main[data-view="customers"] > #viewCustomers,
main[data-view="day"] > #viewDay,
main[data-view="help"] > #viewHelp { display: block; }

.ag-callbar {
  align-items: center; gap: 12px; width: calc(100% - 24px); margin: 0 12px 8px; padding: 10px 16px; border: 0; border-radius: 20px;
  background: var(--accent); color: var(--accent-text); text-align: left; cursor: pointer; font-family: inherit;
}
.ag-callbar:not(.hidden) { display: flex; }
.ag-calldot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.ag-callbar-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; font-size: 14.5px; }
.ag-callbar-text b { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-callbar-go { font-size: 12.5px; font-weight: 800; opacity: 0.9; }

/* Phone: the sections become a tab bar at the bottom. */
@media (max-width: 800px) {
  body.has-nav .ag-shell { display: block; }
  body.has-nav .ag-nav:not(.hidden) {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 20; flex-direction: row; justify-content: space-around; gap: 0;
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--border);
  }
  .ag-navbtn { flex: 1 1 0; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 0; font-size: 11.5px; border-radius: 16px; }
  .ag-navdot { top: 4px; left: calc(50% + 8px); }
  body.has-nav .ag-main { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .ag-callbar { position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 21; width: auto; margin: 0 12px; box-shadow: var(--shadow-lift); }
}
@media (min-width: 801px) {
  /* the side menu is its own rounded panel, like the cards beside it */
  body.has-nav .ag-nav:not(.hidden) {
    position: relative; top: 0; align-self: stretch; min-height: calc(100vh - 140px); margin: 18px 12px 18px 0; padding: 12px 10px; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
  }
  .ag-callbar { position: fixed; left: 24px; bottom: 24px; width: 280px; margin: 0; z-index: 21; box-shadow: var(--shadow-lift); }
}

/* Phones that also have the one-handed dock (agent-app.css): the section tabs sit just above it. */
@media (max-width: 640px) {
  body.has-nav.app-has-dock .ag-nav:not(.hidden) {
    bottom: calc(90px + env(safe-area-inset-bottom)); padding-bottom: 6px; z-index: 49; box-shadow: none;
  }
  body.has-nav.app-has-dock .ag-main { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  body.has-nav.app-has-dock .ag-callbar { bottom: calc(90px + 64px + env(safe-area-inset-bottom)); z-index: 51; }
}

/* Mute (agent-call.js): the pressed Unmute button and the Muted chip by the call timer,
   as the Chrome extension's bar shows them. */
#muteBtn.on, #holdBtn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.ag-mutechip {
  font-style: normal; display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--pill); white-space: nowrap;
  background: var(--warn-soft); color: var(--warn-text); font-size: 12px; font-weight: 800; line-height: 1.5;
}
.ag-mutechip::before {
  content: ""; width: 13px; height: 13px; flex: none; background: currentColor;
  -webkit-mask: var(--ag-micoff) center / contain no-repeat; mask: var(--ag-micoff) center / contain no-repeat;
}
.ag-mutechip.hidden { display: none; }
:root {
  --ag-micoff: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18M9 9v3a3 3 0 0 0 5.1 2.1M15 9.3V6a3 3 0 0 0-5.7-1.3'/%3E%3Cpath d='M5 11a7 7 0 0 0 11.5 5.4M19 11a7 7 0 0 1-.4 2.3M12 18v3'/%3E%3C/svg%3E");
}
/* "Agents must be in LeadSquared" (agent.js lsqNote, docs/LEADSQUARED.md) */
.ag-lsqnote { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-text); font-weight: 600; font-size: 13.5px; }
.ag-lsqnote.hidden { display: none; }
