/* styles.css */
:root{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --panel2:#fbfcff;
  --text:#121522;
  --muted:#5b6477;
  --accent:#1499e0;          /* PBSG brand blue (from logo) */
  --accent-strong:#0e6aa6;   /* darker brand blue — for text/contrast on white */
  --brand-navy:#1d3f5e;      /* PBSG brand navy (from logo) */
  --border:rgba(18,21,34,.10);
}

*{ box-sizing:border-box; }
html{
  margin:0;
  padding:0;
  height:100%;
  overflow:hidden;
}
body{
  margin:0;
  padding:0;
  height:100vh;
  max-height:100vh;
  overflow:hidden;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
  background:var(--bg);
  color:var(--text);
  display:flex;
  flex-direction:column;
}
.topbar{ flex-shrink:0; }
code{
  background:rgba(20,153,224,.10);
  padding:2px 6px;
  border-radius:6px;
}

.topbar{
  display:flex;
  gap:12px;
  align-items:center;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  position:sticky;
  top:0;
  background:rgba(246,247,251,.92);
  backdrop-filter: blur(10px);
  z-index:100;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  letter-spacing:.2px;
}
.brand-title-desktop{
  display:inline;
}
.brand-title-mobile{
  display:none;
}

.brand-logo{
  height:38px;
  width:auto;
  display:block;
}

.tag-filter-wrap{ position:relative; flex-shrink:0; }
.tag-filter-btn{ padding:8px 12px; border-radius:8px; border:1px solid var(--border); background:var(--panel); color:var(--text); font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; }
.tag-filter-btn:hover{ border-color:var(--accent); background:rgba(20,153,224,.06); }
.tag-filter-dropdown{ position:absolute; top:100%; left:0; margin-top:4px; min-width:280px; background:var(--panel); border:1px solid var(--border); border-radius:8px; box-shadow:0 6px 20px rgba(0,0,0,.12); z-index:110; overflow:hidden; }
.tag-filter-dropdown button{ display:block; width:100%; padding:10px 14px; border:none; background:0; color:var(--text); font-size:13px; text-align:left; cursor:pointer; }
.tag-filter-dropdown button:hover{ background:rgba(20,153,224,.08); }
.tag-filter-dropdown button[aria-selected="true"]{ background:rgba(20,153,224,.12); font-weight:600; }
.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex:1;
}
.search{
  flex:1;
  min-width:260px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
}

.sidebar-toggle{
  display:none;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  padding:10px 14px;
  border-radius:999px;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  align-items:center;
  gap:6px;
}
.sidebar-toggle-icon{
  display:inline-block;
  transition:transform .15s ease;
}
.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-icon{
  transform:rotate(180deg);
}

.layout{
  display:grid;
  grid-template-columns: 320px 1fr;
  flex:1;
  min-height:0;
  overflow:hidden;
  align-items:stretch;
}

.sidebar{
  border-right:1px solid var(--border);
  padding:14px;
  background:linear-gradient(180deg,var(--panel),rgba(255,255,255,.6));
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.sidebar > *:last-child{ margin-bottom:0; }

.side-group{ margin-bottom:14px; }

.side-heading{
  font-size:18px;
  font-weight:900;
  color:var(--text);
  margin:6px 4px 12px;
}

.templates-spacer{ height:14px; }

.templates-box{
  border:2px solid rgba(20,153,224,.25);
  background:rgba(20,153,224,.04);
  border-radius:14px;
  padding:12px;
}

.nav{ display:flex; flex-direction:column; gap:6px; }

.category{
  margin:10px 0 6px;
  padding:10px 10px;
  border-radius:12px;
  background:rgba(18,21,34,.03);
  border:1px solid var(--border);
  font-weight:750;
  font-size:13px;
}

.nav a{
  display:block;
  text-decoration:none;
  color:var(--text);
  padding:10px 10px;
  border-radius:10px;
  border:1px solid transparent;
}
.nav a:hover{ background:rgba(18,21,34,.04); }
.nav a.active{
  border-color:rgba(20,153,224,.35);
  background:rgba(20,153,224,.10);
}

.content{
  padding:18px;
  overflow-y: auto;
  min-height: 0;
  scrollbar-gutter: stable;
}

/* Expandable guide with subsections in sidebar */
.nav-guide-with-subs{ margin-bottom:4px; }
.nav-guide-trigger{
  display:block;
  padding:10px 10px;
  text-align:left;
  line-height:1.4;
}
.nav-guide-trigger::before{
  content:"";
  display:inline-block;
  width:0;
  height:0;
  border-left:5px solid transparent;
  border-right:5px solid transparent;
  border-top:6px solid var(--muted);
  margin-right:8px;
  vertical-align:middle;
  transform:translateY(-2px);
  transition:transform .15s ease;
}
.nav-guide-with-subs.expanded .nav-guide-trigger::before{
  transform:rotate(-90deg) translateY(-2px);
}
.nav-subsections{
  display:none;
  flex-direction:column;
  gap:2px;
  margin-left:14px;
  margin-top:4px;
  padding-left:8px;
  border-left:2px solid var(--border);
}
.nav-guide-with-subs.expanded .nav-subsections{ display:flex; }
.nav-subsection{
  font-size:13px;
  padding:6px 10px;
}

.page-header{
  padding:6px 2px 2px;
}
.page-header h1{
  margin:0;
  padding:0;
  line-height:1.2;
  font-size:20px;
}
.page-header p{ margin:4px 0 0; font-size:13px; }

.muted{ color:var(--muted); }

.page-body{
  max-width:1200px;
  margin:0 auto;
  padding:18px;
}

.card{
  border:1px solid var(--border);
  border-radius:14px;
  background:rgba(18,21,34,.02);
  padding:14px;
  margin:12px 0;
}
.card h2{ margin:0 0 10px; font-size:18px; }

.card.templates-surface{
  border:2px solid rgba(20,153,224,.25);
  background:rgba(20,153,224,.03);
}

/* Default list styles */
ol{ padding-left:18px; margin:0; }
li{ margin:10px 0; }

/* ---------------- Guide steps (NOT templates) ---------------- */
/* Bigger, more readable steps + more space between step numbers */
.card ol{
  font-size:16px;
  line-height:1.65;
}
.card ol > li{
  margin:0 0 22px;
}
.card ol > li:last-child{
  margin-bottom:0;
}

/* Keep nested lists inside guides readable */
.card ol ul,
.card ol ol{
  margin:8px 0 0 18px;
}
.card ol ul li,
.card ol ol li{
  margin:6px 0;
}

/* Communication & Enquiries: separate checklist section (session-only) */
.checklist-section .checklist-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.checklist-section .checklist-row{
  display:flex;
  align-items:flex-start;
  gap:10px;
  cursor:pointer;
  font-size:15px;
  line-height:1.4;
}
.checklist-section .checklist-cb{
  flex-shrink:0;
  margin-top:3px;
  cursor:pointer;
  width:18px;
  height:18px;
}
.checklist-section .checklist-label{
  color:var(--text);
}

.video-chapter-buttons{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.video-chapter-btn{ padding:8px 14px; border:1px solid var(--border); border-radius:10px; background:var(--panel); color:var(--text); font-size:13px; cursor:pointer; }
.video-chapter-btn:hover{ border-color:var(--accent); background:rgba(20,153,224,.06); }

.video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}


.step-media{
  display:block;             /* force onto new line (fix: not after text) */
  width:fit-content;         /* shrink to image width when smaller */
  max-width:800px;           /* cap large screenshots */
  margin-top:12px;
  margin-bottom:48px;
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  text-align:left;           /* keep internal alignment normal */
}

/* Keep it left aligned even if a parent ever gets centered */
.card ol > li > .step-media{
  margin-left:0;
  margin-right:auto;
}

.step-media img{
  display:block;
  width:auto;                /* keep natural size if smaller */
  max-width:100%;            /* shrink if bigger than container */
  height:auto;               /* keep proportions */
}

/* Expandable images: magnifying glass cursor on hover */
.step-media img[data-enlargeable]{
  cursor:zoom-in;
}

.step-media .cap{
  padding:10px;
  font-size:12px;
  color:var(--muted);
  border-top:1px solid var(--border);
}


/* Password overlay: full viewport, box centered in the middle */
.password-overlay{
  display:flex;
  align-items:center;
  justify-content:center;
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(0,0,0,.5);
  z-index:1000;
}
.password-box{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:24px;
  min-width:280px;
  box-shadow:0 12px 40px rgba(0,0,0,.2);
}
.password-box h2{ margin:0 0 14px; font-size:20px; }
.password-box input{ width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--border); font-size:14px; box-sizing:border-box; margin-bottom:10px; }
.password-box .btn{ margin-top:8px; width:100%; padding:10px; font-size:14px; }
.password-error{ display:none; color:#b91c1c; font-size:13px; font-weight:600; margin-bottom:10px; }

.actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.actions .btn{
  flex-shrink:0;
  /* Focus/active ring via box-shadow so it never changes layout or causes overflow */
  outline:none;
}
.actions .btn::-moz-focus-inner{ border:0; }
.actions .btn:focus,
.actions .btn:active{
  box-shadow:0 0 0 2px var(--accent);
}
.actions .btn:focus:not(:focus-visible),
.actions .btn:active:not(:focus-visible){
  box-shadow:none;
}
.btn{
  cursor:pointer;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  padding:9px 10px;
  border-radius:10px;
  font-size:12px;
}
.btn.primary{
  border-color:rgba(20,153,224,.35);
  background:rgba(20,153,224,.10);
}
.btn:hover{ border-color:rgba(20,153,224,.35); }

.tooltip-wrap{
  position:relative;
  display:inline-flex;
}
.tooltip-wrap .tooltip{
  position:absolute;
  bottom:100%;
  left:50%;
  transform:translate(-50%, 6px);
  margin-bottom:6px;
  padding:10px 12px;
  width:360px;
  min-width:360px;
  max-width:min(360px, 90vw);
  box-sizing:border-box;
  background:var(--text);
  color:#fff;
  font-size:12px;
  line-height:1.4;
  border-radius:8px;
  white-space:normal;
  opacity:0;
  visibility:hidden;
  transition:opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events:none;
  z-index:50;
  box-shadow:0 4px 12px rgba(0,0,0,.2);
}
.tooltip-wrap .tooltip::after{
  content:"";
  position:absolute;
  top:100%;
  left:50%;
  margin-left:-6px;
  border:6px solid transparent;
  border-top-color:var(--text);
}
.tooltip-wrap:hover .tooltip{
  opacity:1;
  visibility:visible;
  transform:translate(-50%, 0);
}

.template-tabs{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin:0 0 14px;
}
.template-group{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.template-group-header{
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--muted);
}
.template-group-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.tab{
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-size:13px;
  flex-shrink:0;
  outline:none;
  box-sizing:border-box;
}
.tab::-moz-focus-inner{ border:0; }
.tab:focus,
.tab:active{
  box-shadow:0 0 0 2px var(--accent);
}
.tab:focus:not(:focus-visible),
.tab:active:not(:focus-visible){
  box-shadow:none;
}
.tab.active{
  border-color:rgba(20,153,224,.35);
  background:rgba(20,153,224,.10);
}

.template-subject{ margin:6px 0 12px; }

.small{ font-size:14px; color:var(--muted); }

/* Template preview spacing (tuned) */
.template{
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  font-size:16px;
  line-height:1.45;

  /* Disable highlighting/selecting ONLY inside the email template preview box */
  -webkit-user-select:none;
  user-select:none;
  cursor:default;
}

/* Allow selecting/copying links */
.template a{
  -webkit-user-select:text;
  user-select:text;
  cursor:pointer;
}

/* Base text spacing */
.template{
  line-height:1.45;
}

.template p{
  margin:0 0 10px;
}
.template p:last-child{
  margin-bottom:0;
}

/* Lists – tight but readable */
.template ul,
.template ol{
  margin:4px 0 12px 18px;
  padding:0;
}

.template li{
  margin:0;
}

/* Ensure content AFTER lists does not collapse */
.template ul + p,
.template ol + p{
  margin-top:12px;
}

/* Numbered steps spacing */
.template ol > li{
  margin-bottom:12px;
}
.template ol > li:last-child{
  margin-bottom:0;
}

/* Line breaks */
.template br{
  line-height:1.25;
}

/* Hide Outlook spacer paragraphs in website preview */
.template p[style*="mso-line-height-rule"]{
  margin:0 !important;
  line-height:0 !important;
  font-size:0 !important;
  height:0 !important;
  overflow:hidden !important;
}

/* -------- PACE-specific tuning -------- */

.template.pace p{
  margin:0 0 8px;
}

.template.pace p + ol,
.template.pace p + ul{
  margin-top:2px !important;
}

.template.pace ol,
.template.pace ul{
  margin-bottom:16px !important;
}

/* Nested lists inside PACE steps */
.template.pace ol > li{
  margin-bottom:8px;
}

.template.pace ol > li > ul{
  margin:6px 0 12px 18px;
}

.template.pace ol > li > ul > li{
  margin:0 0 4px;
}

.template.pace ol > li > ul > li:last-child{
  margin-bottom:0;
}

/* ---- Fix: spacing after table-wrapped bullet lists (Outlook-friendly HTML) ---- */

/* Give the table block itself some breathing room */
.template table{
  margin:0 0 12px !important;
  border-collapse:collapse;
}

/* If a paragraph comes right after the table, add top space */
.template table + p{
  margin-top:12px !important;
}

/* If a list is inside a table cell and has inline margin:0, override it for website preview */
.template table ul,
.template table ol{
  margin:4px 0 12px 18px !important;
  padding:0 !important;
}

/* Also handle the case where the next element is another block (rare) */
.template table + div,
.template table + section{
  margin-top:12px !important;
}

/* Attachments block inside template panel */
.attachments{
  margin-top:12px;
  padding-top:10px;
  border-top:1px solid var(--border);
}
.attachments-title{
  font-weight:800;
  font-size:13px;
  margin:0 0 8px;
}
.attachments-buttons{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
a.dl-btn{
  display:inline-block;
  text-decoration:none;
  border:1px solid rgba(20,153,224,.35);
  background:rgba(20,153,224,.10);
  color:var(--text);
  padding:9px 10px;
  border-radius:10px;
  font-size:12px;
}
a.dl-btn:hover{
  border-color:rgba(20,153,224,.55);
}

/* Image lightbox: hidden when closed so it doesn't take space or show a bar */
.image-lightbox{
  display:none;
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(0,0,0,.85);
  z-index:1000;
  align-items:center;
  justify-content:center;
  padding:20px;
  cursor:pointer;
}
.image-lightbox.active{
  display:flex;
}
.image-lightbox-content{
  position:relative;
  max-width:85vw;
  max-height:90vh;
  cursor:default;
  display:flex;
  align-items:center;
  justify-content:center;
}
.image-lightbox-content img{
  display:block;
  max-width:85vw;
  max-height:90vh;
  width:auto;
  height:auto;
  object-fit:contain;
  border-radius:8px;
  box-shadow:0 4px 20px rgba(0,0,0,.5);
}
.image-lightbox-close{
  position:fixed;
  width:40px;
  height:40px;
  background:rgba(255,255,255,.95);
  border:2px solid rgba(0,0,0,.1);
  border-radius:50%;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  font-weight:700;
  color:var(--text);
  z-index:1002;
  pointer-events:auto;
  box-shadow:0 2px 8px rgba(0,0,0,.15);
}
.image-lightbox-close::before{
  content:"\2715";
  font-size:20px;
  font-weight:700;
}

.footer{
  display:none;
}

@media (max-width: 900px){
  .layout{ grid-template-columns: 1fr; }
  .topbar{
    flex-wrap:wrap;
    align-items:flex-start;
  }
  .brand{
    flex:1 1 auto;
  }
  .brand-title-desktop{
    display:none;
  }
  .brand-title-mobile{
    display:inline;
  }
  .topbar-right{
    flex:1 1 100%;
  }
  .search{
    min-width:0;
    flex:1 1 100%;
  }
  .sidebar-toggle{
    display:flex;
  }
  .tools-group{
    display:none;
  }
  .sidebar{
    border-right:none;
    border-bottom:1px solid var(--border);
    max-height:0;
    padding-top:0;
    padding-bottom:0;
    opacity:0;
    pointer-events:none;
    transition:max-height .2s ease, opacity .2s ease, padding-top .2s ease, padding-bottom .2s ease;
  }
  .sidebar.sidebar-open{
    max-height:70vh;
    opacity:1;
    pointer-events:auto;
    padding-top:14px;
    padding-bottom:14px;
  }
}

/* Capacity checker toolbar (mounted under main.content) */
#capacityBar{
  width:100%;
  box-sizing:border-box;
  padding:10px;
  display:grid;
  gap:8px;
  grid-template-columns:1fr;
  align-items:stretch;
  justify-items:stretch;
  border-bottom:1px solid var(--border);
  background:var(--panel);
}
#capacityBar #cityButtons{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-content:flex-start;
  width:100%;
}
#capacityBar > label{
  font-size:12px;
  color:var(--text);
  display:grid;
  gap:4px;
  width:100%;
  min-width:0;
}
#capacityBar #suburb{
  padding:10px;
  border:1px solid var(--border);
  border-radius:10px;
  font-size:14px;
  width:100%;
  box-sizing:border-box;
  background:var(--panel);
}
#capacityBar #status{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  width:100%;
}

.call-guide-shell{
  border:1px solid var(--border);
  background:var(--panel);
  border-radius:16px;
  padding:0;
  margin:0;
}
/* Sticky control bar: status, actions and call-type tabs stay visible while the
   guide scrolls. The scroll container is main.content. */
.cg-controlbar{
  position:sticky;
  top:0;
  z-index:20;
  padding:12px 16px;
  background:var(--panel);
  border-bottom:1px solid var(--border);
  border-radius:16px 16px 0 0;
}
#callGuideContent{
  padding:16px;
}
.call-guide-actions{
  display:flex;
  gap:8px;
  margin-bottom:10px;
  align-items:center;
  flex-wrap:wrap;
}
.lca-controls-mount{
  margin-left:auto;
  display:flex;
  align-items:center;
}
.lca-transcript-mount{
  margin:0 16px 16px;
}
.lca-transcript-toggle[aria-expanded="true"]{
  background:rgba(20,153,224,.10);
  border-color:rgba(20,153,224,.35);
  color:#0e6aa6;
}
.lca-panel-compact{
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 10px;
  border-radius:10px;
  border:1px solid rgba(20,153,224,.28);
  background:linear-gradient(180deg, rgba(20,153,224,.08), rgba(255,255,255,.95));
  max-width:100%;
  flex-wrap:wrap;
}
.lca-panel-compact .lca-controls-label{
  font-weight:700;
  font-size:13px;
  color:#0e6aa6;
  white-space:nowrap;
}
.lca-panel-compact .lca-active-calls{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  align-items:center;
  padding:0;
  border:none;
  background:transparent;
  min-height:0;
}
.lca-panel-compact .lca-active-call{
  flex-direction:row;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  font-size:12px;
  line-height:1.2;
  border-radius:999px;
}
.lca-panel-compact .lca-active-call-number{
  font-size:12.5px;
}
.lca-panel-compact .lca-active-call-meta{
  font-size:10.5px;
  letter-spacing:.03em;
}
.lca-panel-compact .lca-detach-btn{
  padding:4px 10px;
  font-size:12px;
}

/* Live status pill — staff must always know whether it's listening */
.lca-status-pill{
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:4px 11px 4px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
  border:1px solid var(--border);
  background:#fff;
  color:var(--muted);
}
.lca-status-dot{
  width:9px;
  height:9px;
  border-radius:50%;
  background:currentColor;
  flex:none;
}
.lca-status-pill[data-state="idle"]{ color:#5b6477; border-color:rgba(18,21,34,.14); }
.lca-status-pill[data-state="connecting"]{
  color:#9a6b00;
  background:rgba(255,248,230,.9);
  border-color:rgba(200,120,0,.35);
}
.lca-status-pill[data-state="connected"]{
  color:#0e6aa6;
  background:rgba(20,153,224,.08);
  border-color:rgba(20,153,224,.30);
}
.lca-status-pill[data-state="listening"]{
  color:#0d7a3f;
  background:rgba(31,122,58,.10);
  border-color:rgba(31,122,58,.35);
}
.lca-status-pill[data-state="listening"] .lca-status-dot{
  animation:lca-listen-pulse 1.3s ease-in-out infinite;
}
.lca-status-pill[data-state="error"]{
  color:#b91c1c;
  background:rgba(185,28,28,.07);
  border-color:rgba(185,28,28,.35);
}
@keyframes lca-listen-pulse{
  0%{ box-shadow:0 0 0 0 rgba(31,122,58,.55); }
  70%{ box-shadow:0 0 0 7px rgba(31,122,58,0); }
  100%{ box-shadow:0 0 0 0 rgba(31,122,58,0); }
}
@media (prefers-reduced-motion: reduce){
  .lca-status-pill[data-state="listening"] .lca-status-dot{ animation:none; }
}
.lca-transcript-panel{
  padding:0;
  overflow:hidden;
  border:1px solid var(--border);
  background:var(--panel);
}
.lca-transcript-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:9px 13px;
  border-bottom:1px solid var(--border);
}
.lca-transcript-title{
  font-size:13px;
  font-weight:700;
}
.lca-transcript-copy{
  padding:4px 10px;
  font-size:12px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fff;
  color:var(--text);
  cursor:pointer;
}
.lca-transcript-copy:hover{ border-color:rgba(20,153,224,.35); }
.lca-transcript-copy:focus-visible{ outline:none; box-shadow:0 0 0 3px rgba(20,153,224,.25); }
.lca-transcript-panel .lca-transcript{
  border:none;
  border-radius:0;
  max-height:280px;
}
.call-guide-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:0;
}
.call-guide-tab{
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  border-radius:10px;
  padding:8px 12px;
  font-weight:700;
  cursor:pointer;
}
.call-guide-tab.active{
  background:rgba(20,153,224,.12);
  border-color:rgba(20,153,224,.45);
}
.cg-group{
  margin:0 0 20px;
  border:none;
  background:none;
  padding:0;
}
.cg-group:last-child{
  margin-bottom:0;
}
.cg-additional-notes-section{
  margin-top:20px;
}
.cg-additional-notes-section .cg-field textarea.cg-additional-notes-textarea,
textarea.cg-additional-notes-textarea{
  min-height:200px;
  resize:vertical;
  line-height:1.5;
}
.lca-suggestion.lca-suggestion-multiline{
  display:flex;
  align-items:flex-start;
  border-radius:12px;
  padding:8px 10px;
  max-width:min(100%, 42rem);
}
.cg-group-title{
  margin:0 0 10px;
  font-size:15px;
  font-weight:800;
  color:var(--brand-navy);
  display:flex;
  align-items:center;
  gap:8px;
}
.cg-group-title::before{
  content:"";
  flex:none;
  width:4px;
  height:16px;
  border-radius:2px;
  background:var(--accent);
}
.cg-group-body{
  display:grid;
  gap:9px;
}
.cg-item{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:11px;
  align-items:start;
  padding:11px 12px;
  border:1px solid var(--border);
  border-radius:11px;
  background:#fff;
  transition:border-color .12s ease, background .12s ease;
}
.cg-item:hover{
  border-color:rgba(20,153,224,.30);
}
.cg-item-check{
  margin-top:2px;
  width:17px;
  height:17px;
  accent-color:var(--accent);
  flex:none;
}
.cg-item-content{
  min-width:0;
}
.cg-item.completed{
  opacity:.7;
  background:rgba(18,21,34,.03);
  border-color:rgba(18,21,34,.08);
}
.cg-item.completed:hover{
  border-color:rgba(18,21,34,.12);
}
.cg-item.completed .cg-field > label,
.cg-item.completed > .cg-item-content > .cg-script{
  text-decoration:line-through;
  text-decoration-color:rgba(18,21,34,.35);
}
.cg-conditional{
  display:grid;
  gap:10px;
  margin-top:10px;
}
.cg-field{
  display:grid;
  gap:6px;
}
.cg-field-hint{
  margin:0;
  font-size:11px;
  color:#6b7280;
  line-height:1.3;
}
.cg-field input,
.cg-field select,
.cg-field textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  font-size:15px;
}
.cg-field input:focus-visible,
.cg-field select:focus-visible,
.cg-field textarea:focus-visible{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(20,153,224,.20);
}
.call-guide-tab:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(20,153,224,.30);
}
.cg-script{
  margin:0;
  color:#114a73;
  font-weight:600;
  padding:8px 12px;
  border-left:3px solid rgba(20,153,224,.5);
  background:rgba(20,153,224,.06);
  border-radius:0 8px 8px 0;
  line-height:1.5;
}
.cg-footer-note{
  margin:14px 4px 0;
  font-weight:600;
}
.call-guide-leave-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;
}
.call-guide-leave-card{
  width:min(560px,92vw);
  background:#fff;
  border-radius:12px;
  border:1px solid var(--border);
  padding:16px;
}
.call-guide-leave-card h3{ margin:0 0 8px; }
.call-guide-leave-card p{ margin:0 0 12px; color:var(--muted); }
.call-guide-leave-actions{ display:flex; gap:8px; justify-content:flex-end; }

/* Live Call Assist (Call Guide) */
.call-guide-layout{
  display:grid;
  gap:14px;
}
@media (min-width: 1100px){
  .call-guide-layout{
    grid-template-columns:minmax(300px, 380px) 1fr;
    align-items:start;
  }
}
.lca-panel{
  margin:0;
  padding:14px 16px;
  border:1px solid rgba(20,153,224,.28);
  background:linear-gradient(180deg, rgba(20,153,224,.06), rgba(255,255,255,.98));
}
.lca-header{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:10px;
}
.lca-title{
  margin:0 0 4px;
  font-size:17px;
}
.lca-subtitle{
  margin:0;
  font-size:12px;
  line-height:1.4;
  max-width:42rem;
}
.lca-actions{
  display:flex;
  gap:8px;
  flex-shrink:0;
}
.lca-disclaimer{
  font-size:12px;
  line-height:1.45;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(200,120,0,.35);
  background:rgba(255,248,230,.9);
  color:#5a4200;
  margin-bottom:8px;
}
.lca-verify-note{
  margin:0 0 10px;
}
.lca-badge{
  display:inline-block;
  font-size:11px;
  font-weight:700;
  letter-spacing:.02em;
  text-transform:uppercase;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(20,153,224,.14);
  color:#0e6aa6;
}
.lca-meta{
  display:grid;
  gap:6px;
  margin-bottom:12px;
  font-size:13px;
}
.lca-meta-row{
  display:flex;
  gap:8px;
  align-items:baseline;
  flex-wrap:wrap;
}
.lca-meta-label{
  font-weight:700;
  min-width:5.5rem;
  color:var(--muted);
}
.lca-status[data-state="connected"]{
  color:#0d7a3f;
  font-weight:700;
}
.lca-status[data-state="connecting"]{
  color:#9a6b00;
  font-weight:700;
}
.lca-status[data-state="error"],
.lca-status[data-state="idle"]{
  color:var(--muted);
  font-weight:600;
}
.lca-session{
  font-size:11px;
  word-break:break-all;
}
.lca-columns{
  display:grid;
  gap:10px;
}
.lca-block-title{
  margin:0 0 6px;
  font-size:13px;
  font-weight:700;
}
.lca-active-calls-block{
  margin-bottom:8px;
}
.lca-active-calls-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
}
.lca-active-calls-help{
  margin:0 0 8px;
  font-size:12px;
}
.lca-active-calls{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:8px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fbfbfd;
  min-height:46px;
  align-items:center;
}
.lca-active-call{
  display:inline-flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  padding:8px 12px;
  border:1px solid #d1d6e3;
  border-radius:10px;
  background:#fff;
  cursor:pointer;
  font-family:inherit;
  text-align:left;
  transition:background .12s ease, border-color .12s ease, box-shadow .12s ease;
  box-shadow:0 1px 2px rgba(16,24,40,.04);
}
.lca-active-call:hover{
  background:#eef2fb;
  border-color:#b8c2dd;
}
.lca-active-call:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(20,153,224,.25);
}
.lca-active-call-attached{
  background:#dff3e3 !important;
  border-color:#7fc99a !important;
  cursor:default;
}
.lca-active-call-number{
  font-weight:600;
  font-size:13.5px;
  color:#1f2541;
  letter-spacing:.01em;
}
.lca-active-call-meta{
  font-size:11.5px;
  color:#5a6478;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.lca-active-call-attached .lca-active-call-meta{
  color:#1f7a3a;
  font-weight:700;
}
.lca-detach-btn{
  font-size:12px;
  padding:4px 10px;
}
.lca-transcript,
.lca-fields-preview{
  margin:0;
  min-height:88px;
  max-height:300px;
  overflow:auto;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  font-size:12px;
  line-height:1.45;
  word-break:break-word;
}
.lca-transcript-line{
  margin:0 0 6px;
  white-space:pre-wrap;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:baseline;
}
.lca-transcript-line .lca-transcript-text{
  flex:1 1 auto;
  min-width:0;
}
.lca-speaker-tag{
  display:inline-block;
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  padding:1px 7px;
  border-radius:999px;
  background:#e2e8f5;
  color:#3a4670;
  flex:none;
}
.lca-speaker-tag-client{
  background:#dff3e3;
  color:#1f7a3a;
}
.lca-speaker-tag-employee{
  background:#e0e7fb;
  color:#0e6aa6;
}
.lca-transcript-client .lca-transcript-text{
  color:#1f3d27;
}
.lca-transcript-employee .lca-transcript-text{
  color:#2a3260;
}
.lca-transcript-note{
  color:#5a6478;
  font-style:italic;
  font-size:12.5px;
}
.lca-transcript-line.lca-transcript-live{
  margin-bottom:0;
  background:rgba(20,153,224,.08);
  padding:6px 8px;
  border-radius:8px;
  border-left:3px solid rgba(20,153,224,.45);
}
.lca-transcript-line.lca-transcript-live.lca-transcript-client{
  background:rgba(31,122,58,.08);
  border-left-color:rgba(31,122,58,.45);
}
.lca-transcript-line.lca-transcript-live .lca-transcript-text{
  font-style:italic;
}
.lca-suggestion{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:6px;
  padding:5px 6px 5px 12px;
  background:#eef0f6;
  border:1px solid #d1d6e3;
  border-radius:999px;
  color:#2a3260;
  font-size:12.5px;
  cursor:pointer;
  max-width:100%;
  text-align:left;
  font-family:inherit;
  line-height:1.3;
  box-shadow:0 1px 2px rgba(16,24,40,.04);
  transition:background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.lca-suggestion:hover{
  background:#e1e7f7;
  border-color:#b8c2dd;
}
.lca-suggestion:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px rgba(20,153,224,.25);
}
.lca-suggestion-label{
  color:#6b7693;
  font-weight:700;
  font-size:10.5px;
  text-transform:uppercase;
  letter-spacing:.05em;
}
.lca-suggestion-value{
  font-weight:500;
  color:#1f2541;
  word-break:break-word;
  white-space:pre-wrap;
  max-width:100%;
  overflow-wrap:anywhere;
}
.lca-suggestion-dismiss{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  border-radius:50%;
  background:rgba(0,0,0,.05);
  color:#4a5269;
  font-weight:700;
  font-size:14px;
  line-height:1;
  margin-left:2px;
  user-select:none;
}
.lca-suggestion-dismiss:hover{
  background:rgba(0,0,0,.14);
  color:#1f2541;
}
.lca-suggestion-accept{
  display:inline-flex;
  align-items:center;
  padding:2px 9px;
  border-radius:999px;
  background:#0e6aa6;
  color:#fff;
  font-weight:700;
  font-size:11px;
  letter-spacing:.02em;
}
.lca-suggestion:hover .lca-suggestion-accept,
.lca-suggestion:focus-visible .lca-suggestion-accept{
  background:#0c5e94;
}
/* Labelled marker on AI-filled fields (don't rely on colour alone) */
.lca-ai-badge{
  display:inline-block;
  margin-left:8px;
  padding:1px 7px;
  border-radius:999px;
  background:rgba(20,153,224,.14);
  color:#0e6aa6;
  font-size:10.5px;
  font-weight:800;
  letter-spacing:.05em;
  text-transform:uppercase;
  vertical-align:middle;
}
.lca-fields-preview{
  white-space:pre-wrap;
}
.lca-fields-preview{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color:#2a3348;
}
.cg-field input.lca-ai-filled,
.cg-field select.lca-ai-filled,
.cg-field textarea.lca-ai-filled,
input.lca-ai-filled,
select.lca-ai-filled,
textarea.lca-ai-filled{
  background:rgba(20,153,224,.10);
  border-color:rgba(20,153,224,.35);
}
.cg-field input.lca-user-edited,
.cg-field select.lca-user-edited,
.cg-field textarea.lca-user-edited,
input.lca-user-edited,
select.lca-user-edited,
textarea.lca-user-edited{
  background:#fff;
  border-color:var(--border);
}
@keyframes lca-field-pulse{
  0%{ box-shadow:0 0 0 0 rgba(20,153,224,.45); }
  70%{ box-shadow:0 0 0 6px rgba(20,153,224,0); }
  100%{ box-shadow:0 0 0 0 rgba(20,153,224,0); }
}
.lca-pulse{
  animation:lca-field-pulse 1.4s ease-out 1;
}

/* Decision Trees */
.dt-shell{
  border:2px solid rgba(20,153,224,.20);
  background:rgba(20,153,224,.03);
}
.dt-tree-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:8px;
}
.dt-tree-tab{
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  border-radius:10px;
  padding:8px 12px;
  font-weight:700;
  cursor:pointer;
}
.dt-tree-tab.active{
  background:rgba(20,153,224,.12);
  border-color:rgba(20,153,224,.45);
}
.dt-tree-desc{
  margin:0 0 12px;
}
.dt-toolbar{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.dt-zoom-controls{
  display:flex;
  gap:6px;
  align-items:center;
}
.dt-zoom-btn{
  min-width:36px;
  padding:6px 10px;
  font-weight:800;
}
.dt-toolbar-hint{
  margin:0;
  font-size:13px;
}
.dt-graph-host{
  position:relative;
  height:70vh;
  min-height:420px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#f6f7fb;
  overflow:hidden;
}
.dt-viewport{
  width:100%;
  height:100%;
  overflow:hidden;
  cursor:grab;
  touch-action:none;
}
.dt-viewport.is-panning{
  cursor:grabbing;
}
.dt-viewport,
.dt-viewport *{
  -webkit-user-select:none;
  user-select:none;
}
.dt-canvas{
  position:relative;
  transform-origin:0 0;
  will-change:transform;
}
.dt-edges-svg{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:visible;
}
.dt-edge-path{
  fill:none;
  stroke:rgba(18,21,34,.28);
  stroke-width:2;
}
.dt-edge-label{
  display:block;
  box-sizing:border-box;
  max-width:155px;
  padding:4px 10px;
  border-radius:10px;
  background:#fff;
  border:1px solid rgba(18,21,34,.12);
  box-shadow:0 1px 4px rgba(18,21,34,.08);
  font-size:11px;
  font-weight:700;
  line-height:1.3;
  color:#5b6477;
  text-align:center;
  white-space:normal;
  word-break:break-word;
  pointer-events:none;
}
.dt-edge-label-measure-root,
.dt-edge-label-measure-root .dt-edge-label{
  position:fixed;
  left:-9999px;
  top:0;
  visibility:hidden;
  pointer-events:none;
}
.dt-nodes-layer{
  position:absolute;
  inset:0;
}
.dt-node-card{
  position:absolute;
  box-sizing:border-box;
  min-width:200px;
  max-width:280px;
  padding:14px 16px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  box-shadow:0 2px 8px rgba(18,21,34,.06);
  text-align:left;
  cursor:default;
}
.dt-node-card--start{
  border:2px solid rgba(20,153,224,.45);
  background:rgba(20,153,224,.10);
}
.dt-node-card--decision{
  border:2px solid #1499e0;
  background:#fff;
  box-shadow:0 0 0 1px rgba(20,153,224,.08), 0 2px 8px rgba(20,153,224,.10);
}
.dt-node-card--decision::before{
  content:"";
  display:block;
  width:10px;
  height:10px;
  margin:0 auto 8px;
  background:#1499e0;
  transform:rotate(45deg);
  border-radius:2px;
}
.dt-node-card--action{
  background:#f0f4fc;
  border-color:rgba(18,21,34,.14);
}
.dt-node-card--outcome{
  border:none;
  background:linear-gradient(135deg, #1499e0, #0e6aa6);
  color:#fff;
  box-shadow:0 4px 14px rgba(20,153,224,.28);
  text-align:center;
}
.dt-node-title{
  font-size:13px;
  font-weight:800;
  line-height:1.35;
  margin:0 0 6px;
}
.dt-node-detail{
  font-size:12px;
  line-height:1.45;
  color:var(--muted);
  margin:0 0 10px;
}
.dt-node-card--outcome .dt-node-detail{
  color:rgba(255,255,255,.92);
}
.dt-node-template-btn{
  display:block;
  width:100%;
  margin-top:4px;
  padding:7px 10px;
  font-size:12px;
  font-weight:800;
  border-radius:8px;
  border:1px solid rgba(255,255,255,.35);
  background:#fff;
  color:#0e6aa6;
  cursor:pointer;
}
.dt-node-template-btn:hover{
  border-color:#fff;
  background:#f6f8ff;
}
.dt-measure-root{
  position:fixed;
  left:-9999px;
  top:0;
  visibility:hidden;
  pointer-events:none;
}
.dt-measure-root .dt-node-card{
  position:static;
  width:280px;
}
.dt-legend{
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  margin-top:10px;
}
.dt-legend-item{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.dt-legend-swatch{
  width:14px;
  height:14px;
  border-radius:4px;
  display:inline-block;
}
.dt-legend-question{
  border:2px solid #1499e0;
  background:#fff;
}
.dt-legend-start{
  border:2px solid #1499e0;
  background:rgba(20,153,224,.12);
}
.dt-legend-action{
  border:1px solid rgba(18,21,34,.18);
  background:#f0f4fc;
}
.dt-legend-template{
  border:none;
  background:linear-gradient(135deg, #1499e0, #0e6aa6);
}
.dt-legend-outcome{
  border:none;
  background:linear-gradient(135deg, #1499e0, #0e6aa6);
}
.dt-template-modal{
  position:fixed;
  inset:0;
  z-index:1200;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.dt-template-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(18,21,34,.45);
}
.dt-template-modal-card{
  position:relative;
  z-index:1;
  width:min(720px, 100%);
  max-height:min(85vh, 720px);
  display:flex;
  flex-direction:column;
  background:#fff;
  border-radius:14px;
  border:1px solid var(--border);
  box-shadow:0 16px 48px rgba(18,21,34,.18);
}
.dt-template-modal-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:16px 18px 10px;
  border-bottom:1px solid var(--border);
}
.dt-template-modal-header h2{
  margin:0;
  font-size:18px;
}
.dt-template-modal-close{
  border:none;
  background:transparent;
  font-size:24px;
  line-height:1;
  cursor:pointer;
  color:var(--muted);
  padding:0 4px;
}
.dt-template-modal-close:hover{
  color:var(--text);
}
.dt-template-modal-body{
  margin:0;
  padding:14px 18px;
  overflow:auto;
  flex:1;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:13px;
  line-height:1.5;
  white-space:pre-wrap;
  word-break:break-word;
  background:var(--panel2);
}
.dt-template-modal-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  padding:12px 18px 16px;
  border-top:1px solid var(--border);
}
@media (max-width:640px){
  .dt-graph-host{
    height:min(70vh, 520px);
    min-height:320px;
  }
  .dt-toolbar-hint{
    width:100%;
  }
  .dt-node-card{
    min-width:180px;
    max-width:240px;
    padding:12px 14px;
  }
}

/* ───────────────────────── Staff access gate ───────────────────────── */
.access-overlay{
  position:fixed;
  inset:0;
  z-index:2000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:linear-gradient(135deg, rgba(18,21,34,.62), rgba(30,77,216,.45));
  backdrop-filter:blur(6px);
}
.access-box{
  width:min(420px, 100%);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:26px 24px 22px;
  box-shadow:0 24px 60px rgba(18,21,34,.35);
  display:flex;
  flex-direction:column;
}
.access-box h2{
  margin:0 0 4px;
  font-size:21px;
  font-weight:800;
}
.access-sub{
  margin:0 0 18px;
  color:var(--muted);
  font-size:14px;
  line-height:1.45;
}
.access-label{
  font-size:12px;
  font-weight:700;
  letter-spacing:.03em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:6px;
}
.access-box input{
  width:100%;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:10px;
  font-size:16px; /* 16px avoids iOS zoom-on-focus */
  background:#fff;
  color:var(--text);
  box-sizing:border-box;
}
.access-box input:focus-visible{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(20,153,224,.22);
}
.access-error{
  min-height:18px;
  margin:8px 0 0;
  color:#b91c1c;
  font-size:13px;
  font-weight:600;
  line-height:1.35;
}
.access-submit{
  margin-top:14px;
  width:100%;
  padding:12px;
  font-size:15px;
  font-weight:700;
}
.access-submit:disabled{
  opacity:.6;
  cursor:default;
}
.access-skip{
  margin-top:14px;
  border:none;
  background:none;
  color:var(--muted);
  font-size:12.5px;
  text-decoration:underline;
  cursor:pointer;
  align-self:center;
  padding:4px;
}
.access-skip:hover{ color:var(--text); }
