/* Design tokens carried over from the agency's existing snippet-launcher tool,
   so this app reads as a sibling of it rather than something unrelated. */
:root {
  --primary:        #1d4ed8;
  --primary-hover:  #1e40af;
  --primary-soft:   #dbeafe;
  --focus-ring:     rgba(29, 78, 216, 0.18);

  --background: #f7f8fa;
  --surface:    #ffffff;

  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-800: #374151;
  --gray-900: #111827;

  --text-main:  var(--gray-800);
  --text-muted: var(--gray-500);
  --border:     var(--gray-200);

  --success:      #16a34a;
  --success-soft: #f0fdf4;
  --success-text: #15803d;
  --error:        #dc2626;
  --error-soft:   #fef2f2;
  --warn:         #d97706;
  --warn-soft:    #fffbeb;
  --warn-border:  #fde68a;
  --warn-text:    #92400e;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.04);

  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

/* The `hidden` ATTRIBUTE is only `display: none` from the UA stylesheet, so any
   author rule that sets a display beats it — and this file sets `display: flex`
   on .card. Without this, hiding one of those in JS silently does nothing
   and every panel renders at once.
   The per-class workarounds further down (.view[hidden], .notice[hidden])
   predate this and are now redundant; they are left in place
   as they are harmless and removing them is unrelated churn.
   !important is needed rather than source order because an id selector
   can outrank an attribute selector no matter where it sits. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--background);
  color: var(--text-main);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 16px;
  min-height: 100%;
}
.view[hidden] { display: none; }

/* ------------------------------------------------------------- header --- */

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--gray-900);
}

.subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------- card --- */

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: var(--text-main);
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  outline: none;
  user-select: text;
  transition: border-color 120ms, box-shadow 120ms;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ------------------------------------------------------------ notices --- */

.notice {
  padding: 9px 11px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
}
.notice[hidden] { display: none; }

.notice-warn {
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
}

.notice strong { font-weight: 640; }

.notice ul {
  margin: 5px 0 0;
  padding-left: 16px;
}
.notice li { font-family: var(--mono); font-size: 11.5px; }

/* ------------------------------------------------------------ buttons --- */

.btn {
  padding: 9px 14px;
  font: inherit;
  font-weight: 560;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms, opacity 120ms;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

.btn-ghost {
  background: #fff;
  border-color: var(--gray-300);
  color: var(--gray-600);
}
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); }

.btn-sm { padding: 6px 10px; font-size: 12.5px; }

/* ----------------------------------------------------------- settings --- */

.path-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.path {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--gray-600);
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
  user-select: text;
}

.form-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
}

.form-origin { font-weight: 600; font-size: 13px; }

.form-detail {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.form-detail:empty { display: none; }

.form-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.status-dot--green   { background: var(--success); }
.status-dot--red      { background: var(--error); }
.status-dot--neutral { background: var(--gray-400); }

.hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  cursor: pointer;
}
.check input { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

/* ============================================================== sidebar === */
/* White CRM rail from the Agency CRM design: 264px, blue active fill,
   node mark + "Ullrich Insurance", working pages then tools / Sign Out. */
:root {
  --nav-width: 264px;
}

.app {
  display: flex;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

/* =============================================================== login === */
/* Opaque full-page gate. .app stays hidden until sign-in, and this screen
   covers the window so the CRM cannot show through. */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 32px 20px;
  background: var(--background);
  overflow: auto;
}

.login-logo {
  display: block;
  width: auto;
  height: 68px;
  max-width: 100%;
  margin: 2px auto 2px;
  object-fit: contain;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 28px 24px;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.login-card .subtitle {
  margin: 0 0 2px;
  text-align: center;
}

.login-card .btn-primary { width: 100%; }

.sidebar {
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--nav-width);
  width: var(--nav-width);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  overflow: visible;
  z-index: 45;
  user-select: none;
  padding: 0 16px 18px;
  box-sizing: border-box;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 68px;
  height: 68px;
  margin: 0 -16px;
  padding: 0 16px;
  box-sizing: border-box;
}

.sidebar__logo {
  display: block;
  width: auto;
  height: 52px;
  max-width: 100%;
  object-fit: contain;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 3px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar__foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
}

.sidebar__tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--gray-800);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.nav-item:hover { background: #f3f4f6; color: var(--gray-900); }
.nav-item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.is-active::before { display: none; }
.nav-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.nav-item__icon {
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
}

.workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 68px;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  z-index: 40;
}
.topbar__search {
  position: relative;
  width: 340px;
  max-width: 45%;
}
.topbar__search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}
.topbar__search input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--gray-900);
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 10px 12px 10px 38px;
}
.topbar__search input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: none;
  border-color: var(--primary);
}
.topbar__spacer { flex: 1; }
.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 6px;
}
.topbar__sync {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: 0.01em;
}
.topbar__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gray-600);
  cursor: pointer;
  line-height: 0;
}
.topbar__icon svg {
  display: block;
}
.topbar__icon:hover { background: #f3f4f6; color: var(--gray-900); }
.topbar__icon[aria-expanded="true"] { background: #f3f4f6; }
.topbar__gear-wrap { position: relative; }
.topbar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content > .view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.view--narrow > * {
  width: 100%;
  max-width: 680px;
}

.crm-page { padding: 28px; gap: 20px; }
.crm-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.crm-chip {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-600);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
  margin-left: auto;
}
.crm-chip--info {
  color: var(--primary);
  background: #eff4ff;
  border-color: var(--primary-soft);
}

.ql-row { display: flex; align-items: flex-end; gap: 10px; margin: 16px 0 14px; }
.ql-row .ql-field { flex: 1; min-width: 0; }
.ql-row .fu-input { min-width: 0; }
.fu-label--gap { margin-top: 14px; }
.ql-kind-status {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #f9fafb;
  font-size: 13.5px;
  line-height: 1.45;
  color: #4b5563;
}
.ql-kind-status.is-new {
  color: #1d4ed8;
  background: #eff4ff;
  border-color: #dbe4ff;
}
.ql-kind-status.is-cross {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}
.ql-kind-policies-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 650;
}
.ql-kind-policies {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ql-kind-policies li {
  font-size: 13px;
  font-weight: 500;
}
.ql-kind-matches-label {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 650;
}
.ql-kind-matches {
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ql-kind-match {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  cursor: pointer;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.ql-kind-match:hover,
.ql-kind-match:focus-visible {
  background: #eef2ff;
  border-color: #93b4fd;
  outline: none;
}
.ql-kind-status.is-cross .ql-kind-match {
  border-color: #fde68a;
}
.ql-kind-status.is-cross .ql-kind-match:hover,
.ql-kind-status.is-cross .ql-kind-match:focus-visible {
  background: #fffbeb;
  border-color: #fbbf24;
}
.ql-kind-match-name {
  font-size: 13px;
  font-weight: 650;
}
.ql-kind-match-meta {
  font-size: 12px;
  color: #4b5563;
  font-weight: 500;
}
.ql-kind-matches-more {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}

.review-form { padding: 20px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.review-span-2 { grid-column: 1 / -1; }
.docs-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.docs-chips > .fu-btn { flex: none; }

#view-texts {
  overflow: hidden;
}
#view-dashboard {
  flex: 1;
  min-height: 0;
}
#dash-root {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-height: 0;
}
.dash-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 20px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.dash-layout__emergency,
.dash-layout__stats {
  min-width: 0;
  min-height: 0;
}
.dash-layout__emergency {
  display: flex;
  flex-direction: column;
}
.dash-layout__stats {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.dash-layout__stats .dash-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#texts-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.dash-texts__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.dash-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-section__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--gray-900);
}
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.dash-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  text-align: left;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 14px 16px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.dash-stat:hover { border-color: #c7d2fe; background: #fafbff; }
.dash-stat:disabled { cursor: default; }
.dash-stat:disabled:hover { border-color: var(--gray-200); background: #fff; }
.dash-stat__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--gray-500);
}
.dash-stat__value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--gray-900);
}
.dash-stat__note {
  font-size: 12.5px;
  color: var(--gray-400);
  margin-top: 6px;
}

.dash-emergency {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.04);
}
.dash-emergency__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(90deg, #fef2f2 0%, #fff7ed 55%, #fff 100%);
  border-bottom: 1px solid #fecaca;
}
.dash-emergency__beacon {
  font-size: 26px;
  line-height: 1;
  animation: dash-beacon 0.9s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.55));
}
.dash-emergency__titles {
  min-width: 0;
}
.dash-emergency__title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #991b1b;
}
.dash-emergency__truck {
  font-weight: 400;
  font-size: 15px;
}
.dash-emergency__note {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--gray-500);
}
.dash-emergency__table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.dash-emergency__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.dash-emergency__table th,
.dash-emergency__table td {
  text-align: left;
  padding: 9px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-200);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-emergency__table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-500);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 1;
}
.dash-emergency__table th:nth-child(1),
.dash-emergency__table td:nth-child(1) { width: 30%; }
.dash-emergency__table th:nth-child(2),
.dash-emergency__table td:nth-child(2) { width: 26%; }
.dash-emergency__table th:nth-child(3),
.dash-emergency__table td:nth-child(3) { width: 26%; }
.dash-emergency__table th:nth-child(4),
.dash-emergency__table td:nth-child(4) { width: 18%; }
.dash-emergency__age {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.dash-emergency__name {
  font-weight: 650;
  color: var(--gray-900);
}
.dash-emergency__row {
  cursor: pointer;
}
.dash-emergency__row:hover { background: #fff7f7; }
.dash-emergency__row.is-fresh { background: #fef2f2; }
.dash-emergency__row.is-fresh:hover { background: #fee2e2; }
.dash-emergency__empty {
  text-align: left;
  color: var(--gray-500);
  white-space: normal;
  font-weight: 400;
}
.dash-emergency__table tbody tr:last-child td { border-bottom: 0; }

@keyframes dash-beacon {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.7));
  }
  50% {
    opacity: 0.35;
    transform: scale(0.88);
    filter: drop-shadow(0 0 2px rgba(234, 88, 12, 0.35));
  }
}
@media (prefers-reduced-motion: reduce) {
  .dash-emergency__beacon { animation: none; }
}
@media (max-width: 1100px) {
  .dash-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .dash-emergency {
    min-height: 360px;
    max-height: min(70vh, 640px);
  }
}

#call-log-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.call-log-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: 720px;
  flex-shrink: 0;
}
.call-log-filter { max-width: 200px; }
.call-log-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--gray-200);
}
.call-log-head__title { font-size: 15px; font-weight: 700; flex: 1; }
.call-log-head__meta { font-size: 12.5px; color: var(--gray-500); }
.call-log-day-row td {
  padding: 0 !important;
  border-bottom: 0 !important;
  background: #f8fafc;
  position: sticky;
  top: 46px;
  z-index: 1;
}
.call-log-day-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  background: #f8fafc;
}
.call-log-day-row:first-child .call-log-day-head { border-top: 0; }
.call-log-day-head__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}
.call-log-day-head__meta { font-size: 12px; color: var(--gray-500); }
.call-log-when { font-variant-numeric: tabular-nums; color: var(--gray-600); white-space: nowrap; }
.call-log-dur { font-variant-numeric: tabular-nums; white-space: nowrap; }
.call-log-empty { padding: 28px 18px !important; color: var(--gray-500); text-align: center; }
.call-log-empty--day { padding: 12px 18px !important; text-align: left; }
.call-log-dir {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 9px;
}
.call-log-dir.is-in { color: #1d4ed8; background: #dbeafe; }
.call-log-dir.is-out { color: #166534; background: #dcfce7; }
.call-log-who__name { font-weight: 600; }
.call-log-who__phone {
  display: block;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--gray-500);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}
.call-log-who__phone:hover { color: var(--gray-800); text-decoration: underline; }

.review-layout { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.review-inbox { flex: 0 1 360px; min-width: 280px; background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; }
.review-item {
  display: flex; flex-direction: column; gap: 5px; width: 100%; text-align: left;
  padding: 13px 18px; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid #f1f2f4;
  background: #fff; cursor: pointer; font: inherit;
}
.review-item:hover { background: #fafbfc; }
.review-item.is-on { background: #eff4ff; border-left-color: var(--primary); }
.review-detail { flex: 1 1 520px; min-width: 320px; display: flex; flex-direction: column; gap: 20px; }

.tpl-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.tpl-list {
  flex: 1 1 280px;
  min-width: 260px;
  max-width: 360px;
  max-height: min(70vh, 680px);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: auto;
}
.tpl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.tpl-filters .fu-btn {
  flex: 1;
  justify-content: center;
  text-align: center;
  padding: 8px 6px;
  font-size: 13px;
}
.tpl-preview {
  flex: 3 1 420px;
  min-width: 320px;
  overflow: visible;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
}
.tpl-preview__head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}
.tpl-preview__title { font-size: 19px; font-weight: 700; }
.tpl-preview__meta { font-size: 13px; color: #6b7280; margin-top: 4px; }
.tpl-preview__body { padding: 22px 24px; }
.surplus-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}
.surplus-toolbar__name { width: 160px; }
.surplus-toolbar__search { flex: 1; min-width: 180px; }
.surplus-sections { max-width: 280px; }
.surplus-section {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #f1f2f4;
  border-left: 3px solid transparent;
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.surplus-section:hover { background: #fafbfc; }
.surplus-section.is-on {
  background: #eff4ff;
  border-left-color: var(--primary);
}
.surplus-section__name { flex: 1; font-size: 14px; font-weight: 600; }
.surplus-section__count { font-size: 12px; color: #9ca3af; }
.surplus-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.surplus-field { min-width: 0; }
.surplus-field--wide { grid-column: 1 / -1; }
.surplus-group {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #eef0f2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}
.surplus-group--topic {
  margin-top: 16px;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #111827;
}
.surplus-group--topic:first-child {
  margin-top: 0;
}
.surplus-field__head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.surplus-field__head .fu-label { flex: 1; margin-bottom: 6px; }
.surplus-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  font-size: 14px;
  font-weight: 500;
  grid-column: 1 / -1;
}
.surplus-check span { flex: 1; }
.surplus-yn { cursor: pointer; }
@media (max-width: 1100px) {
  .surplus-fields { grid-template-columns: 1fr; }
}
.surplus-pin {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #d1d5db;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.surplus-pin:hover { background: #f3f4f6; color: #ca8a04; }
.surplus-pin.is-on { color: #ca8a04; }
.surplus-foot {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
}
.surplus-status { font-size: 13px; color: #6b7280; }
.tpl-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.tpl-field { position: relative; min-width: 0; }
.tpl-form .fu-tp__row {
  margin-top: 0;
  flex-wrap: wrap;
}
.tpl-form .fu-tp-btn { padding: 8px 12px; }
.tpl-dropdown { position: relative; }
.fu-select__label.is-placeholder { color: var(--gray-400); }
.tpl-agent-opt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.tpl-agent-opt__name { font-weight: 600; }
.tpl-agent-opt__role {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-500);
}
.fu-menu-item.is-on .tpl-agent-opt__role { color: inherit; opacity: 0.75; }
.tpl-policy-menu { max-height: 320px; }
.tpl-policy-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 4px;
  border-radius: var(--radius-sm);
}
.tpl-policy-row.is-on { background: var(--primary-soft); }
.tpl-policy-row .fu-menu-item { flex: 1; min-width: 0; }
.tpl-policy__stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding-right: 4px;
}
.tpl-policy__step {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.tpl-policy__step:hover { border-color: var(--gray-400); }
.tpl-policy__step:disabled {
  opacity: 0.4;
  cursor: default;
}
.tpl-policy__count {
  min-width: 1.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  font-weight: 650;
  color: #111827;
}
.tpl-pack { display: flex; flex-direction: column; gap: 12px; }
.tpl-pack-item {
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}
.tpl-pack-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tpl-pack-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tpl-pack-item__kind {
  font-size: 12.5px;
  color: #6b7280;
  margin-top: 3px;
}
.tpl-pack-item__subject {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-top: 10px;
}
.tpl-pack-item__subject-label { font-weight: 600; color: #6b7280; }
.tpl-pack-item__body {
  font-size: 13px;
  color: #4b5563;
  white-space: pre-wrap;
  line-height: 1.45;
  margin-top: 8px;
}
.tpl-email {
  white-space: normal;
  color: #111827;
  font-size: 13px;
  line-height: 1.45;
}
.tpl-email p { margin: 0; }
.tpl-email a { color: #0563c1; }
.tpl-email ul {
  margin: 0 0 0 22px;
  padding: 0;
}
.tpl-links { display: flex; flex-direction: column; gap: 10px; }
.tpl-link {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  box-sizing: border-box;
}
.tpl-link__text { flex: 1; min-width: 0; }
.tpl-link__label { font-size: 14px; font-weight: 600; color: #111827; }
.tpl-link__url { font-size: 13px; color: #4b5563; word-break: break-word; margin-top: 4px; white-space: pre-wrap; line-height: 1.45; }
.tpl-link .fu-btn { flex: 0 0 auto; }

.msg-row { display: grid; grid-template-columns: minmax(0, 200px) minmax(160px, 1fr) minmax(150px, 190px); align-items: center; gap: 0 14px; padding: 14px 22px; border-bottom: 1px solid #f1f2f4; }
.msg-row:hover { background: #fafbfc; }

.integ-row { display: flex; align-items: center; gap: 16px; padding: 16px 22px; border-bottom: 1px solid #f1f2f4; }
.integ-row:hover { background: #fafbfc; }
.integ-row:last-child { border-bottom: 0; }

.roles-name { font-weight: 600; }
.roles-select { width: 180px; max-width: 42%; flex: none; padding: 8px 10px; }
.roles-settings-card { gap: 10px; }
.roles-settings-list { display: flex; flex-direction: column; }
.roles-settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.roles-settings-who { flex: 1; min-width: 0; }
.roles-settings-who .form-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roles-settings-empty { padding: 8px 0 2px; }

.az-login-page {
  justify-content: center;
  align-items: center;
}

.az-login {
  display: flex;
  justify-content: center;
  width: 100%;
}

.az-login-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 24px 22px;
  gap: 16px;
}

.az-login-card .btn-primary { width: 100%; }

.act-row { display: flex; align-items: baseline; gap: 12px; padding: 11px 22px; }
.act-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; transform: translateY(-2px); }

/* =============================================================== modal === */
/* The one shared AgencyZoom modal (Settings status button and the credentials-
   error alert both open this). Lives outside .app in the DOM, so its fixed
   backdrop covers the sidebar too. */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 24, 27, 0.32);
}

.modal {
  width: 420px;
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  position: relative;           /* positioning context for .modal-close */
  box-shadow: var(--shadow-md); /* overrides .card's --shadow-sm at equal
                                    specificity, since this rule comes later */
}

.modal-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--gray-500);
  font-size: 16px;
  cursor: pointer;
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }

.modal-title {
  margin: 0;
  padding-right: 24px;          /* clears the close button */
  font-size: 15px;
  font-weight: 650;
  color: var(--gray-900);
}

.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========================================================= follow-up queue === */
/* Claude Follow-Up Queue, built into this app's shell. Layout, type, and
   controls follow that page: white cards, uppercase table heads, red × / ink ✓
   marks, contact menus instead of raw tel/mailto. Primary actions still use
   this app's purple so the page reads as a view of Ullrich Quote Form, not a
   second product glued on. Mock data stands in until AgencyZoom is wired. */

.fu {
  gap: 20px;
  padding: 24px 24px 16px;
  min-width: 0;
}

.content > .view.fu {
  overflow: hidden;
}

.fu-title {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--gray-900);
}

.fu-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.fu-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: nowrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

#docs-toolbar.fu-filters {
  flex-wrap: wrap;
  align-items: flex-start;
  row-gap: 14px;
}

.fu-field {
  position: relative;
  min-width: 210px;
}

.fu-filters > .fu-field {
  min-width: 0;
  flex: 1 1 0;
}

.fu-field--short { min-width: min-content; }
.fu-filters > .fu-field--short {
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  min-width: min-content;
}
.fu-field--block { width: 100%; min-width: 0; margin-top: 16px; }

.fu-filters__end {
  margin-left: 0;
  flex: none;
  display: flex;
  align-items: flex-end;
}
#docs-toolbar .fu-filters__end {
  margin-left: auto;
  align-self: flex-end;
}

.fu-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.fu-input,
select.fu-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 14px;
  color: var(--gray-900);
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

input.fu-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: var(--radius-md);
}

input.fu-input:focus { box-shadow: none; }
.fu-input::placeholder { color: var(--gray-400); }
.fu-input:focus,
.fu-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

textarea.fu-input {
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
}

.fu-select {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 14px;
  color: var(--gray-900);
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}
.fu-select:hover { border-color: var(--gray-400); }

.fu-select__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fu-chevron {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--gray-500);
}

.fu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
}
.fu-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.fu-btn:active { transform: none; }
.fu-btn:disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.fu-btn-primary {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-color: transparent;
}
.fu-btn-primary:hover { background: var(--primary-hover); }

.fu-btn-secondary {
  background: #fff;
  color: var(--gray-600);
  border-color: var(--gray-300);
}
.fu-btn-secondary:hover { background: #f3f4f6; }

.fu-btn-pager { font-size: 13.5px; padding: 8px 14px; }
.fu-btn-pager:disabled,
.fu-btn-pager.is-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.fu-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 250px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.14);
  padding: 6px;
}
.fu-menu.topbar__menu {
  top: auto;
  bottom: calc(100% + 6px);
  left: auto;
  right: 0;
  min-width: 190px;
}
.fu-menu--short { min-width: 110px; }
.fu-menu--wide { left: 0; right: 0; min-width: 0; max-height: 232px; }
.fu-menu.is-flip { top: auto; bottom: calc(100% + 6px); }

.fu-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid #f1f2f4;
  margin-bottom: 4px;
}

.fu-menu-link {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.fu-menu-link--all { color: var(--primary); }
.fu-menu-link--clear { color: var(--gray-500); }

.fu-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: var(--gray-900);
}
.fu-menu-item:hover { background: #f3f4f6; }
.fu-menu-item.is-on {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.fu-check {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #fff;
}
.fu-check.is-on {
  background: var(--primary);
  border-color: var(--primary);
}

.fu-menu-count {
  font-variant-numeric: tabular-nums;
  color: var(--gray-500);
  font-size: 13px;
}

.fu-table-card {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.fu-table-head {
  flex: 0 0 auto;
  background: #fff;
  padding-right: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 2;
}
.fu-table-head th {
  position: static;
}

.fu-table-scroll {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #c5cad3 transparent;
  scrollbar-gutter: stable;
}
.fu-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.fu-table-scroll::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0 6px;
}
.fu-table-scroll::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 99px;
  border: 2px solid #fff;
}
.fu-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
.fu-table-scroll::-webkit-scrollbar-button,
.fu-table-scroll::-webkit-scrollbar-button:single-button,
.fu-table-scroll::-webkit-scrollbar-button:vertical:decrement,
.fu-table-scroll::-webkit-scrollbar-button:vertical:increment,
.fu-table-scroll::-webkit-scrollbar-button:start:decrement,
.fu-table-scroll::-webkit-scrollbar-button:end:increment {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}
.fu-table-scroll::-webkit-scrollbar-corner {
  background: transparent;
}

.fu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* Follow-Up Queue: columns share the card width instead of growing a
   horizontal scrollbar. Other .fu-table pages keep auto layout. */
.fu .fu-table-scroll {
  overflow-x: hidden;
  overflow-y: auto;
}

.fu-table--queue {
  table-layout: fixed;
  width: 100%;
  font-size: 12.5px;
  border-collapse: separate;
  border-spacing: 0;
}

.fu-col-name { width: 18%; }
.fu-col-last { width: 12%; }
.fu-col-age { width: 10%; }
.fu-col-tries { width: 8%; }
.fu-col-source { width: 20%; }
.fu-col-check { width: 8%; }
.lic-col-person { width: 14%; }
.lic-col-date { width: 12%; }
.lsn-col-name { width: 40%; }
.lsn-col-agent { width: 35%; }
.lsn-col-date { width: 25%; }

.fu-table th {
  text-align: left;
  padding: 14px 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 1;
}
.fu-table-head .fu-table th {
  border-bottom: none;
}
.fu-table th:nth-child(3) { padding-left: 16px; padding-right: 16px; }
.fu-th-check { text-align: center !important; padding-left: 8px; padding-right: 8px; }

.fu-table td {
  padding: 14px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f2f4;
  white-space: nowrap;
}
.fu-table td:nth-child(3) { padding: 14px 16px; }
.fu-table tbody tr:hover { background: #fafbfc; }
.fu-table td.fu-td-check { padding: 10px 8px; text-align: center; }
.fu-table td.fu-muted { color: var(--gray-600); }
.fu-table td.fu-num { font-variant-numeric: tabular-nums; color: var(--gray-600); }

.fu-table--queue th,
.fu-table--queue td {
  padding: 10px 12px;
  overflow: hidden;
  white-space: normal;
  line-height: 1.35;
  vertical-align: middle;
}
.fu-table--queue th:first-child,
.fu-table--queue td:first-child {
  padding-left: 24px;
}
.fu-table--queue th:last-child,
.fu-table--queue td:last-child {
  padding-right: 24px;
}
.fu-table--queue th {
  font-size: 10.5px;
  letter-spacing: 0.04em;
}
.fu-table--queue .fu-th-check,
.fu-table--queue td.fu-td-check {
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}
.fu-table--queue th:last-child.fu-th-check,
.fu-table--queue td:last-child.fu-td-check {
  padding-right: 24px;
}
.fu-table--queue td.fu-td-name {
  text-align: left;
}
.fu-name-cell,
.fu-name-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
}
.fu-name-head {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
}
.fu-star-spacer {
  flex: none;
  width: 22px;
  height: 22px;
}
.fu-star-btn {
  flex: none;
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  line-height: 0;
}
.fu-star-btn:hover {
  background: #f3f4f6;
  color: var(--warn);
}
.fu-star-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.fu-star-btn.is-starred {
  color: var(--warn);
}
.fu-star-btn svg {
  display: block;
}
.fu-table--queue .fu-name-btn {
  font-size: 13px;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  white-space: normal;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
}
.fu-table--queue .fu-name-btn__text {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: break-word;
  text-align: left;
  width: 100%;
}
.fu-table--queue .fu-attempt {
  font-size: 12.5px;
  width: 100%;
  max-width: none;
}
.fu-table--queue td.fu-muted {
  text-overflow: unset;
  overflow-wrap: break-word;
}
.fu-table--queue td.fu-num,
.fu-table--queue .fu-td-last {
  white-space: nowrap;
}

#view-documents { overflow: hidden; }
#docs-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.docs-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.docs-inbox {
  min-height: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.docs-inbox__list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.docs-group + .docs-group { border-top: 1px solid var(--gray-200); }
.docs-group__head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 4px;
  background: #fff;
}
.docs-group__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 8px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.docs-group__toggle:hover { background: #f8f9fb; }
.docs-group__toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}
.docs-group__chevron {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--gray-400);
  transform: rotate(-90deg);
}
.docs-group.is-open .docs-group__chevron { transform: rotate(0deg); }
.docs-group__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-group__count {
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
}
.docs-group__archive {
  flex: none;
  margin: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gray-500);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.docs-group__archive:hover {
  background: #f3f4f6;
  color: var(--gray-800);
}
.docs-group__archive:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}
.docs-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 14px 10px 32px;
  border: 0;
  border-left: 3px solid transparent;
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.docs-item:hover { background: #fafbfc; }
.docs-item.is-on { background: #eff4ff; border-left-color: var(--primary); }
.docs-item__dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.docs-item__dot.is-done { background: #d1d5db; }
.docs-item__copy {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.docs-item__file {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-item.is-done .docs-item__file { font-weight: 500; }
.docs-item__type {
  font-size: 12px;
  color: var(--gray-500);
}
.docs-item__type.is-need { color: #b45309; }
.docs-stage {
  min-width: 0;
  min-height: 0;
}
.docs-type-select {
  width: auto;
  min-width: 220px;
  max-width: 100%;
  padding: 6px 8px;
  font-size: 13px;
}
.docs-preview {
  height: 100%;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.docs-preview__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--gray-200);
}
.docs-preview__who { flex: 1; min-width: 0; }
.docs-preview__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-preview__meta {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-preview__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.docs-preview__type {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.docs-preview__type .fu-label { margin: 0; }
.docs-preview__type .docs-type-select {
  flex: 1;
  max-width: 360px;
}
.docs-preview__form-type {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
}
.docs-preview__body {
  flex: 1;
  min-height: 0;
  display: flex;
  background: #f8f8fa;
}
.docs-preview__empty {
  margin: auto;
  padding: 28px 18px;
  font-size: 13.5px;
  color: var(--gray-500);
  text-align: center;
}
.docs-preview__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
}
.docs-preview__frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.docs-preview__form {
  width: 100%;
  overflow: auto;
  padding: 16px 18px 20px;
}
.docs-preview__field-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-top: 12px;
}
.docs-preview__field-label:first-child { margin-top: 0; }
.docs-preview__field-value {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--gray-900);
  white-space: pre-wrap;
}
@media (max-width: 1100px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-inbox { max-height: 280px; }
  .docs-preview { min-height: 420px; }
}

.fu-name-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 6px;
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--gray-900);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  margin: -4px -6px;
  cursor: pointer;
  white-space: nowrap;
}
.fu-name-btn:hover { background: #f3f4f6; }
.fu-name-btn svg { width: 13px; height: 13px; flex: none; color: var(--gray-400); }
.fu-name-btn__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.fu-attempt {
  min-width: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fu-attempt.is-today { color: var(--success); }
.fu-attempt.is-warn { color: var(--warn); }
.fu-attempt.is-stale { color: var(--error); }

.fu-mark {
  width: 30px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 17px;
  line-height: 1;
  font-weight: 700;
}
.fu-mark:hover { background: #f3f4f6; }
.fu-mark.is-done { color: var(--gray-900); }
.fu-mark.is-todo { color: var(--error); }
.fu-mark.is-partial { color: #d97706; }
span.fu-mark { cursor: default; }
span.fu-mark:hover { background: transparent; }

.fu-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.fu-pager__label { font-size: 14px; color: var(--gray-600); }
.fu-pager__label strong { color: var(--gray-900); font-weight: 700; }
.fu-pager__btns { display: flex; align-items: center; gap: 8px; }

.lic-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 12.5px;
  color: var(--gray-900);
}
.lic-input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.lic-check {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
}

.fu-pop {
  position: fixed;
  inset: 0;
  z-index: 90;
}
.fu-pop__card {
  position: fixed;
  z-index: 100;
  min-width: 210px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.16);
  padding: 6px;
}

.fu-pop-head {
  padding: 7px 10px 9px;
  border-bottom: 1px solid #f1f2f4;
  margin-bottom: 4px;
}
.fu-pop-head__name {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.fu-pop-head__name:hover { text-decoration: underline; }
.fu-pop-head__name:disabled { cursor: wait; opacity: 0.7; }
.fu-pop-head__meta {
  font-size: 12.5px;
  color: var(--gray-500);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fu-pop-head__meta.is-copy,
.fu-dialog__sub-line.is-copy {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.fu-pop-head__meta.is-copy:hover,
.fu-dialog__sub-line.is-copy:hover {
  color: var(--gray-800);
  text-decoration: underline;
}

.fu-pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: var(--gray-900);
}
.fu-pop-item:hover { background: #f3f4f6; }
.fu-pop-item:disabled { opacity: 0.55; cursor: wait; }
.fu-pop-item svg { width: 15px; height: 15px; color: var(--gray-500); flex: none; }
.fu-pop-item__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fu-pop-item__chevron { width: 14px; height: 14px; color: var(--gray-400); }

.fu-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.fu-dialog {
  width: 100%;
  max-width: 490px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.18);
  padding: 24px 26px 20px;
}

/* Quick Lead / Queue lead drag-and-drop. */
#ql-modal .fu-dialog {
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}
#ql-modal.is-create .ql-dropzone,
#ql-modal.is-create #ql-queue-meta,
#ql-modal.is-create #ql-notes-wrap {
  display: none;
}
#ql-modal.is-queue .ql-agent-wrap,
#ql-modal.is-queue #ql-create-details {
  display: none;
}

.ql-files-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  padding: 16px 14px;
  border: 2px dashed var(--gray-300);
  border-radius: 10px;
  background: #f9fafb;
  text-align: center;
  cursor: pointer;
}
.ql-files-dropzone:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.ql-files-dropzone.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ql-files-dropzone__label {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--gray-900);
}
.ql-files-dropzone__hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--gray-500);
}
.ql-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.ql-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
}
.ql-file-row__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ql-file-row__size {
  flex: none;
  font-size: 12px;
  color: #6b7280;
}
.ql-file-row__remove {
  flex: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.ql-file-row__remove:hover { color: #b91c1c; }
.ql-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ql-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-900);
  cursor: pointer;
}
.ql-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.ql-option input {
  margin: 0;
}

.ql-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 18px;
  padding: 22px 18px;
  border: 2px dashed var(--gray-300);
  border-radius: 10px;
  background: #f9fafb;
  text-align: center;
  cursor: copy;
  transition: border-color 120ms, background 120ms, box-shadow 120ms;
}

.ql-dropzone:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ql-dropzone.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.12);
}

.ql-dropzone.is-busy {
  border-color: var(--primary);
  background: #fff;
  cursor: wait;
  opacity: 0.85;
}

.ql-dropzone.is-done {
  border-color: var(--success);
  background: var(--success-soft);
}

.ql-dropzone__icon {
  color: var(--gray-400);
  flex: none;
}

.ql-dropzone.is-active .ql-dropzone__icon,
.ql-dropzone.is-busy .ql-dropzone__icon {
  color: var(--primary);
}

.ql-dropzone.is-done .ql-dropzone__icon {
  color: var(--success);
}

.ql-dropzone__label {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--gray-900);
}

.ql-dropzone__hint {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--gray-500);
  max-width: 320px;
}

.ql-dropzone__mono {
  font-family: var(--mono);
  font-size: 12px;
}

#ql-modal.ql-drop-active .fu-dialog {
  outline: 2px dashed var(--primary);
  outline-offset: 8px;
}

.fu-dialog__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--gray-900);
  overflow-wrap: anywhere;
}
.fu-dialog__sub {
  font-size: 13.5px;
  color: var(--gray-600);
  margin-top: 5px;
  margin-bottom: 18px;
}
.fu-dialog__sub-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--gray-900);
}
.fu-dialog__sub-line {
  margin-top: 2px;
}

.fu-dialog .fu-label { margin-bottom: 6px; }

.fu-tp { margin-top: 16px; }
.fu-tp__row { display: flex; gap: 8px; margin-top: 8px; }

.fu-tp-btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-600);
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 8px 20px;
  cursor: pointer;
}
.fu-tp-btn:hover { border-color: var(--gray-400); }
.fu-tp-btn.is-on {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary);
}

.fu-dialog__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

#fu-text-body {
  min-height: 120px;
}
#fu-text-error {
  margin-top: 12px;
}

/* Winback / Quoted Not Sold: Last review instead of Tries and the
   pass-checklist columns. */
.fu--no-checklist .fu-col-tries,
.fu--no-checklist .fu-col-check,
.fu--no-checklist .fu-th-tries,
.fu--no-checklist .fu-th-check,
#view-outbound-leads:not(.fu--no-checklist) .fu-col-review,
#view-outbound-leads:not(.fu--no-checklist) .fu-th-review { display: none; }
.fu-col-review { width: 14%; }
.fu-review-date {
  font: inherit;
  font-size: 13px;
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 3px 6px;
  background: transparent;
}
.fu-review-date:focus { outline: 2px solid var(--primary-soft); outline-offset: 1px; }
