:root {
  --ink:#172f35;
  --muted:#62767b;
  --teal:#156558;
  --line:#dfe7e6;
  --bg:#f3f6f5;
  --soft:#e7f2ee
}
* {
  box-sizing:border-box
}
body {
  margin:0;
  font-family:Inter,Arial,sans-serif;
  color:var(--ink);
  background:var(--bg);
  font-size:16px
}
button,input,select,textarea {
  font:inherit
}
button,a,input,select,textarea {
  outline-offset:4px
}
button,a {
  -webkit-tap-highlight-color:transparent
}
button {
  cursor:pointer
}
a {
  color:var(--teal)
}
button {
  border:1px solid var(--line);
  background:white;
  border-radius:8px;
  padding:10px 15px;
  color:var(--ink)
}
button:hover {
  background:#edf4f1
}
button.primary,.primary {
  background:var(--teal);
  color:white;
  border-color:var(--teal)
}
button.primary:hover {
  background:#0f5045
}
.brand {
  font-weight:700;
  font-size:23px;
  letter-spacing:-1px;
  display:flex;
  align-items:center;
  gap:10px
}
.brand-icon {
  width:33px;
  height:33px;
  border-radius:10px;
  background:var(--teal);
  color:white;
  display:grid;
  place-items:center;
  font-size:25px;
  font-weight:400
}
.muted {
  color:var(--muted)
}
.small {
  font-size:14px
}
.eyebrow {
  text-transform:uppercase;
  font-size:12px;
  letter-spacing:1.8px;
  font-weight:700;
  color:var(--teal)
}
.badge {
  display:inline-flex;
  border-radius:5px;
  padding:5px 8px;
  font-size:12px;
  font-weight:600;
  white-space:nowrap;
  background:#eef1f3;
  color:#50636b
}
.badge.green {
  background:#e6f3ec;
  color:#24634a
}
.badge.amber {
  background:#fff1d8;
  color:#805712
}
.badge.blue {
  background:#e9eefc;
  color:#455a8a
}
.avatar {
  width:40px;
  height:40px;
  display:grid;
  place-items:center;
  background:#e9eeea;
  border-radius:50%;
  flex-shrink:0;
  font-size:14px;
  font-weight:600
}
.button-link {
  text-decoration:none;
  display:inline-block;
  border:1px solid var(--line);
  border-radius:8px;
  padding:10px 15px;
  font-size:14px;
  background:white
}
.customer-header {
  padding:26px 6%;
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:#fff;
  border-bottom:1px solid var(--line)
}
.customer-main {
  max-width:780px;
  margin:48px auto 60px;
  padding:0 24px
}
.success-icon {
  border:1px solid #cadfd3;
  background:#e9f4ed;
  width:64px;
  height:64px;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:30px;
  color:var(--teal);
  margin:0 auto 24px
}
.intro {
  text-align:center
}
.intro h1 {
  font-family:Georgia,serif;
  font-weight:400;
  font-size:44px;
  letter-spacing:-1.5px;
  margin:12px 0 14px
}
.intro p {
  line-height:1.7;
  max-width:530px;
  margin:0 auto;
  color:var(--muted)
}
.receipt {
  margin:32px 0 24px;
  background:white;
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 8px 30px #173c3205
}
.receipt-top {
  padding:22px 26px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:1px solid var(--line)
}
.receipt-top strong {
  font-size:17px
}
.receipt-grid {
  padding:24px 26px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px
}
.field-label {
  display:block;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.9px;
  color:var(--muted);
  margin-bottom:7px
}
.field-value {
  font-size:15px;
  line-height:1.5
}
.next-box {
  background:#edf5f0;
  padding:23px 26px;
  display:flex;
  gap:16px;
  align-items:flex-start
}
.next-box p {
  margin:6px 0 0;
  font-size:14px;
  line-height:1.6;
  color:#4b6b61
}
.center {
  text-align:center
}
.customer-footer {
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin:28px 0;
  color:var(--muted);
  font-size:13px
}
.app-header {
  background:white;
  padding:18px 30px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:1px solid var(--line)
}
.header-right {
  display:flex;
  align-items:center;
  gap:20px
}
.workspace {
  max-width:1600px;
  margin:auto;
  padding:27px 30px
}
.page-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:24px
}
.page-heading h1 {
  font-size:28px;
  margin:0 0 7px;
  letter-spacing:-.8px
}
.page-heading p {
  margin:0;
  font-size:14px;
  color:var(--muted)
}
.stats {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:26px
}
.stat {
  border:1px solid var(--line);
  background:white;
  border-radius:10px;
  padding:16px 20px
}
.stat span {
  color:var(--muted);
  font-size:13px
}
.stat strong {
  font-size:28px;
  display:block;
  margin:9px 0 4px;
  font-weight:600;
  letter-spacing:-1px
}
.stat small {
  font-size:12px;
  color:var(--muted)
}
.stat:first-child {
  background:#e8f1ed;
  border-color:#cfdfd7
}
.inbox {
  background:white;
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden
}
.toolbar {
  padding:18px 20px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px
}
.tabs {
  display:flex;
  gap:6px
}
.tab {
  border:0;
  background:transparent;
  font-size:14px;
  padding:10px 14px
}
.tab.active {
  background:var(--soft);
  color:var(--teal);
  font-weight:600
}
.count {
  font-size:12px;
  margin-left:6px;
  background:#fff9;
  padding:2px 6px;
  border-radius:4px
}
.search {
  border:1px solid var(--line);
  border-radius:7px;
  padding:10px 12px;
  width:260px;
  font-size:14px
}
.filters {
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 20px;
  border-bottom:1px solid var(--line);
  flex-wrap:wrap
}
.filters label {
  font-size:12px;
  color:var(--muted);
  display:flex;
  align-items:center;
  gap:8px
}
.filters select {
  font-size:13px;
  padding:8px 25px 8px 10px;
  border:1px solid var(--line);
  border-radius:6px;
  background:white;
  color:var(--ink);
  max-width:180px
}
.clear {
  border:0;
  padding:5px;
  color:var(--teal);
  font-size:13px
}
.result-count {
  margin-left:auto;
  font-size:12px;
  color:var(--muted)
}
.panes {
  display:grid;
  grid-template-columns:365px minmax(0,1fr);
  min-height:660px
}
.lead-list {
  border-right:1px solid var(--line);
  max-height:830px;
  overflow:auto
}
.lead-row {
  border:0;
  border-radius:0;
  border-bottom:1px solid var(--line);
  width:100%;
  text-align:left;
  padding:20px;
  display:block;
  background:white;
  position:relative
}
.lead-row.selected {
  background:#f0f7f3;
  box-shadow:inset 3px 0 var(--teal)
}
.row-head {
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  margin-bottom:8px
}
.lead-row strong {
  font-size:15px
}
.lead-row time {
  font-size:12px;
  color:var(--muted)
}
.lead-row p {
  font-size:13px;
  color:var(--muted);
  margin:8px 0 12px;
  line-height:1.5
}
.row-foot {
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:space-between
}
.row-foot small {
  font-size:12px;
  color:var(--muted)
}
.detail {
  padding:28px 30px;
  min-width:0
}
.detail-header {
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start
}
.person {
  display:flex;
  gap:14px;
  align-items:center
}
.person .avatar {
  width:50px;
  height:50px;
  background:#eee9df;
  font-size:17px
}
.person h2 {
  font-size:23px;
  margin:0 0 6px;
  letter-spacing:-.5px
}
.person p {
  margin:0;
  font-size:13px;
  color:var(--muted)
}
.contact-line {
  display:flex;
  gap:20px;
  flex-wrap:wrap;
  font-size:13px;
  color:var(--muted);
  padding:19px 0;
  border-bottom:1px solid var(--line)
}
.section-title {
  font-size:14px;
  font-weight:600;
  margin:25px 0 16px
}
.details-grid {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:22px 15px
}
.details-grid .field-label {
  font-size:11px
}
.details-grid .field-value {
  font-size:14px
}
.quote {
  border-left:2px solid #ccd9d3;
  padding-left:14px;
  font-size:14px;
  line-height:1.7;
  margin:0;
  color:#486067
}
.ai-card {
  background:#f3f6fb;
  border:1px solid #dfe5ef;
  border-radius:10px;
  margin-top:25px;
  padding:20px
}
.ai-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px
}
.ai-heading h3 {
  margin:0;
  font-size:15px
}
.ai-card p,.ai-card li {
  font-size:14px;
  line-height:1.7;
  color:#4b5e72
}
.ai-card ul {
  padding-left:18px;
  margin:10px 0
}
.ai-meta {
  font-size:12px;
  color:#63758c
}
.transcript-toggle {
  background:transparent;
  border:0;
  border-top:1px solid #dbe2ed;
  border-radius:0;
  width:100%;
  text-align:left;
  color:#375e8b;
  font-size:13px;
  font-weight:600;
  margin-top:14px;
  padding:15px 0 0;
  display:flex;
  justify-content:space-between
}
.transcript {
  padding-top:15px
}
.utterance {
  margin:12px 0;
  padding:12px 14px;
  border-radius:8px;
  background:white
}
.utterance.patient {
  background:#e7edf6;
  margin-left:22px
}
.utterance strong {
  font-size:12px
}
.utterance time {
  float:right;
  font-size:11px;
  color:var(--muted)
}
.utterance p {
  margin:6px 0 0
}
.next-action {
  padding:16px 18px;
  border:1px solid var(--line);
  border-radius:9px;
  margin-top:20px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px
}
.next-action p {
  font-size:13px;
  color:var(--muted);
  margin:5px 0 0
}
.next-action strong {
  font-size:14px
}
.empty {
  padding:50px 24px;
  text-align:center;
  color:var(--muted);
  font-size:14px;
  line-height:1.7
}
.staff-select {
  border:1px solid var(--line);
  padding:7px;
  border-radius:6px;
  background:white;
  font-size:13px;
  max-width:100%
}
.back {
  display:none;
  margin-bottom:20px
}
dialog {
  border:1px solid var(--line);
  border-radius:16px;
  padding:28px;
  width:min(520px,calc(100% - 32px));
  color:var(--ink);
  box-shadow:0 20px 80px #142d3340
}
dialog::backdrop {
  background:#0f292b70
}
dialog h2 {
  margin:0 0 8px;
  font-size:25px
}
dialog p {
  font-size:14px;
  color:var(--muted);
  line-height:1.6
}
.form-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:15px
}
form label {
  display:block;
  font-size:13px;
  margin:16px 0 7px
}
form input,form select,form textarea {
  width:100%;
  border:1px solid #cdd9d5;
  padding:11px;
  border-radius:7px;
  background:white;
  font-size:14px;
  color:var(--ink)
}
form textarea {
  resize:vertical;
  min-height:80px
}
.dialog-actions {
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:23px
}
.notice {
  font-size:12px;
  color:var(--muted);
  line-height:1.5;
  margin-top:14px
}
.toast {
  position:fixed;
  bottom:24px;
  left:50%;
  transform:translateX(-50%);
  background:#183e34;
  color:white;
  padding:14px 22px;
  border-radius:9px;
  box-shadow:0 5px 30px #0002;
  z-index:10;
  max-width:90%;
  font-size:14px
}
[hidden] {
  display:none!important
}
@media(min-width:1500px) {
  .panes {
    grid-template-columns:420px minmax(0,1fr)
  }
}
@media(max-width:1000px) {
  .workspace {
    padding:22px 18px
  }
  .panes {
    grid-template-columns:310px minmax(0,1fr)
  }
  .detail {
    padding:24px 20px
  }
  .details-grid {
    grid-template-columns:1fr 1fr
  }
  .filters label {
    flex-direction:column;
    align-items:flex-start;
    gap:5px
  }
  .result-count {
    align-self:end;
    padding-bottom:10px
  }
  .header-right .muted {
    display:none
  }
}
@media(max-width:720px) {
  .customer-header {
    padding:20px
  }
  .customer-header .muted {
    display:none
  }
  .customer-main {
    margin-top:32px;
    padding:0 18px
  }
  .intro h1 {
    font-size:34px
  }
  .receipt-grid {
    gap:20px;
    padding:22px
  }
  .customer-footer {
    flex-direction:column;
    align-items:center
  }
  .app-header {
    padding:16px 18px
  }
  .header-right .button-link {
    padding:8px;
    font-size:12px
  }
  .header-right {
    gap:10px
  }
  .page-heading {
    align-items:flex-start;
    gap:15px
  }
  .page-heading h1 {
    font-size:25px
  }
  .page-heading .muted {
    font-size:12px
  }
  .stats {
    grid-template-columns:1fr 1fr;
    gap:10px
  }
  .stat {
    padding:14px
  }
  .toolbar {
    align-items:stretch;
    flex-direction:column;
    padding:14px
  }
  .search {
    width:100%
  }
  .filters {
    padding:14px;
    gap:10px
  }
  .filters label {
    flex:1;
    min-width:110px
  }
  .filters select {
    width:100%;
    max-width:none
  }
  .panes {
    display:block;
    min-height:500px
  }
  .lead-list {
    border-right:0;
    max-height:none
  }
  .detail {
    display:none
  }
  .inbox.show-detail .detail {
    display:block
  }
  .inbox.show-detail .lead-list {
    display:none
  }
  .back {
    display:inline-block
  }
  .detail-header {
    flex-wrap:wrap
  }
  .next-action {
    align-items:flex-start;
    flex-direction:column
  }
  .receipt-top {
    padding:20px;
    gap:8px
  }
  .form-grid {
    grid-template-columns:1fr;
    gap:0
  }
  .contact-line {
    gap:10px
  }
  .result-count {
    margin-left:0
  }
  .receipt-grid .field-value {
    overflow-wrap:anywhere
  }
}
@media(min-width:721px) {
  .panes {
    height:720px;
    min-height:0
  }
  .lead-list,.detail {
    overflow-y:auto;
    max-height:none
  }
}

/* Typography and navigation */
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #152e36;
  -webkit-font-smoothing: antialiased;
}
.screen-nav {
  display: flex;
  gap: 8px;
  padding: 12px 30px;
  background: #143c35;
}
.screen-nav a {
  padding: 11px 18px;
  border-radius: 7px;
  color: #e1eeea;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.screen-nav a:hover { background: #ffffff15; }
.screen-nav a[aria-current='page'] {
  background: #fff;
  color: #174f42;
  font-weight: 700;
}
.intro h1 {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1.4px;
}
.field-label, .details-grid .field-label {
  color: #5f707b;
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 8px;
  line-height: 1.4;
}
.field-value, .details-grid .field-value {
  display: block;
  color: #122e39;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}
.details-grid {
  padding: 20px;
  background: #f7f9fa;
  border: 1px solid #e5eaed;
  border-radius: 10px;
  gap: 24px 20px;
}
.section-title {
  font-size: 17px;
  font-weight: 700;
  color: #172f35;
  margin-top: 28px;
}
.person h2 { font-size: 25px; font-weight: 700; }
.person p, .contact-line { font-size: 14px; }
.quote { font-size: 16px; color: #344e5a; }
.ai-heading h3 { font-size: 17px; font-weight: 700; }
.ai-card p, .ai-card li { font-size: 15px; color: #34495e; }
.ai-meta { font-size: 13px; }
.badge { font-size: 13px; font-weight: 600; }
.row-head strong { font-size: 16px; font-weight: 700; }
.lead-row p { font-size: 14px; color: #526673; }
.row-foot { flex-wrap: wrap; }
.row-foot small { font-size: 12px; color: #356a55; font-weight: 600; }
.stat span { font-size: 14px; font-weight: 500; }
.stat strong { font-weight: 700; }
.stat small { font-size: 13px; }
.filters label { font-size: 14px; font-weight: 500; }
.filters select, .staff-select {
  color: #153440;
  font-size: 14px;
  font-weight: 600;
}
.field-value.qualification { font-size: 15px; }
.field-value.positive { color: #176347; }
form label { font-size: 14px; font-weight: 600; color: #405967; }
form input, form select, form textarea {
  font-size: 16px;
  font-weight: 500;
  color: #16333d;
}
.field-help { font-size: 14px; line-height: 1.6; color: #5f707b; margin-top: 9px; }
.receipt-grid { gap: 24px; }
.next-action strong { font-size: 16px; }
.next-action p { font-size: 14px; }
@media(max-width:720px) {
  .screen-nav { padding: 10px 12px; gap: 6px; }
  .screen-nav a { flex: 1; padding: 10px; font-size: 13px; }
  .intro h1 { font-size: 33px; }
  .details-grid { grid-template-columns: 1fr; padding: 18px; }
  .receipt-grid .field-value { font-size: 15px; }
  .tab { padding: 10px; font-size: 14px; }
}

/* Keep every dropdown chevron inset from the field edge. */
select,
.filters select,
.staff-select,
form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23465f68' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  padding-right: 42px;
}
select:disabled {
  background-color: #f1f4f5;
  color: #687a82;
}

.review-assignment {
  border-left: 3px solid #486e9a;
  padding: 10px 12px;
  background: #e8eef7;
  border-radius: 0 6px 6px 0;
}
.review-assignment strong { color: #203f60; font-weight: 700; }
.notes-section { border-top: 1px solid var(--line); margin-top: 28px; }
.notes-count { font-size: 13px; color: var(--muted); margin-left: 6px; font-weight: 500; }
.lead-note { padding: 15px 0; border-bottom: 1px solid #e8edee; }
.note-heading { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note-heading strong { font-size: 14px; color: #213f49; }
.note-heading time { font-size: 12px; color: #657780; }
.lead-note p { font-size: 15px; line-height: 1.65; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.notes-empty { font-size: 14px; color: #657780; }
.note-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.note-actions span { font-size: 13px; color: #657780; }
.notes-section textarea { min-height: 100px; }

.detail-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-top: 8px; }
.detail-tab { border: 0; border-radius: 0; padding: 16px 0 13px; background: transparent; color: #62767b; font-size: 15px; font-weight: 600; border-bottom: 3px solid transparent; }
.detail-tab.active { border-bottom-color: var(--teal); color: var(--teal); }
.detail-tab:hover { background: transparent; color: var(--teal); }
#detailNotes .notes-section { border-top: 0; margin-top: 0; }
