/* IceGenet Chat admin UI. Palette: ice blue #3A97EC / #1C76CF, navy #142035 / #0A1424,
   canvas #F4F8FC, blush #E2918D (rare accent). System font stack, no framework. A customer's design
   (src/lib/branding.php) sets the brand, sidebar, radius and font variables and body classes. */
:root {
  /* Brand (ice blue) as a 50-900 ramp; a customer's design (branding.php) replaces it and the sidebar below. */
  --brand-50: #EFF8FF; --brand-100: #DBEFFE; --brand-200: #BEE3FD; --brand-300: #91D0FB; --brand-400: #6BBDFA;
  --brand-500: #3A97EC; --brand-600: #1C76CF; --brand-700: #195FAA; --brand-800: #194E8A; --brand-900: #163F6E;
  --brand-rgb: 58 151 236;
  --navy-950: #0A1424; --navy-900: #142035; --navy-800: #1F2E45; --navy-700: #2D3F59; --navy-600: #3D526F; --navy-500: #536A8A;
  --navy-400: #7189A8; --navy-300: #A0B4CD; --navy-200: #CBD8E8; --navy-100: #E4ECF5; --navy-50: #F3F7FB;
  --canvas: #F4F8FC;
  --blush: #E2918D;
  --blush-50: #FDF3F2;
  --accent: var(--blush);
  --green: #16A34A;
  --green-50: #ECFDF3;
  --amber: #B45309;
  --amber-50: #FFF7E6;
  --red: #DC2626;
  --red-50: #FEF2F2;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 2px rgba(16, 42, 71, .05), 0 1px 1px rgba(16, 42, 71, .03);
  --shadow-pop: 0 12px 32px -8px rgba(16, 42, 71, .22), 0 2px 6px rgba(16, 42, 71, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  /* Sidebar and mobile top bar */
  --sb-bg: radial-gradient(420px 260px at -10% -8%, rgb(58 151 236 / .22), transparent 65%), linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  --sb-text: var(--navy-200); --sb-strong: #fff; --sb-muted: var(--navy-400); --sb-hover: rgba(255, 255, 255, .06);
  --sb-active-bg: rgb(var(--brand-rgb) / .18); --sb-active-text: #fff; --sb-active-icon: var(--brand-300); --sb-active-bar: var(--brand-500);
  --sb-border: rgba(255, 255, 255, .08); --sb-panel: rgba(255, 255, 255, .04); --sb-panel-border: rgba(255, 255, 255, .1); --sb-product: var(--brand-300);
  --topbar-bg: var(--navy-900); --topbar-text: #fff; --topbar-border: transparent;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.55 var(--font); color: var(--navy-800); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; color: var(--navy-900); line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 .75em; }
code, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--navy-50); border: 1px solid var(--navy-100); padding: 1px 5px; border-radius: 5px; color: var(--navy-700); }
hr { border: 0; border-top: 1px solid var(--navy-100); margin: 20px 0; }
::selection { background: var(--brand-100); color: var(--navy-900); }
/* Thin, light scrollbars everywhere (zero specificity: a part's own rule, like hidden tab scrollbars, wins). */
:where(*) { scrollbar-width: thin; scrollbar-color: var(--navy-200) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-200); border: 2px solid transparent; border-radius: 8px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--navy-300); }
.sidebar :where(*) { scrollbar-color: rgb(255 255 255 / .18) transparent; }
.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; flex: none; }
.muted { color: var(--navy-500); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------------------------------------------------------------- shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 244px; z-index: 40; display: flex; flex-direction: column;
  background: var(--sb-bg); color: var(--sb-text); border-right: 1px solid var(--sb-border);
  transition: transform .25s ease;
}
/* The IceGenet Chat mark, or a customer's logo / initial with its name (partial _brand.php) */
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: var(--sb-strong); min-width: 0; }
.brand:hover { text-decoration: none; color: var(--sb-strong); }
.brand-mark, .brand-initial { width: 34px; height: 34px; border-radius: var(--radius); display: grid; place-items: center; flex: none; background: linear-gradient(135deg, var(--brand-400), var(--brand-600)); box-shadow: 0 6px 16px -6px rgb(var(--brand-rgb) / .8); }
.brand-mark svg { width: 20px; height: 20px; color: #fff; }
.brand-initial { color: #fff; font-weight: 800; font-size: 16px; }
.brand-img { max-height: 34px; max-width: 130px; object-fit: contain; flex: none; }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: .01em; }
.brand-name b { color: var(--sb-product); font-weight: 700; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sb-product); margin-top: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.nav-section { margin: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-muted); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0; border-radius: var(--radius-sm); color: var(--sb-text); font-weight: 500; }
.nav-link:hover { background: var(--sb-hover); color: var(--sb-strong); text-decoration: none; }
.nav-link.active { background: var(--sb-active-bg); color: var(--sb-active-text); box-shadow: inset 2px 0 0 var(--sb-active-bar); }
.nav-link .icon { color: var(--sb-muted); }
.nav-link.active .icon { color: var(--sb-active-icon); }
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--blush); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.sidebar-foot { border-top: 1px solid var(--sb-border); padding: 12px; }
.support-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; border-radius: var(--radius-sm); color: var(--sb-text); font-size: 13px; background: var(--sb-panel); border: 1px solid var(--sb-panel-border); }
.support-link:hover { color: var(--sb-strong); text-decoration: none; background: var(--sb-hover); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); color: inherit; }
.me:hover { background: var(--sb-hover); text-decoration: none; color: inherit; }
.me-name { color: var(--sb-strong); font-weight: 600; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 11.5px; color: var(--sb-muted); }
.sidebar-actions { display: flex; gap: 6px; margin-top: 8px; }
.sidebar-actions a, .sidebar-actions button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--sb-panel-border); background: var(--sb-panel); color: var(--sb-text); font: inherit; font-size: 12.5px; cursor: pointer;
}
.sidebar-actions a:hover, .sidebar-actions button:hover { background: var(--sb-hover); color: var(--sb-strong); text-decoration: none; }
.sidebar-actions a[aria-current="page"] { color: var(--sb-active-text); background: var(--sb-active-bg); }
.sidebar-actions form { flex: 1; display: flex; }
.main { flex: 1; min-width: 0; margin-left: 244px; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 28px 32px 48px; width: 100%; }   /* every page uses the full width */
.content-wide { max-width: none; padding: 0; height: 100vh; }
.backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(10, 20, 36, .45); z-index: 30; }
  .main { margin-left: 0; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; height: 54px; padding: 0 12px; background: var(--topbar-bg); color: var(--topbar-text); border-bottom: 1px solid var(--topbar-border); }
  .topbar .brand { padding: 0; color: var(--topbar-text); }
  .topbar .brand-mark, .topbar .brand-initial { width: 28px; height: 28px; }
  .topbar .brand-img { max-height: 28px; }
  .menu-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm); background: rgb(127 127 127 / .14); color: inherit; cursor: pointer; }
  .content { padding: 20px 16px 40px; }
  .content-wide { height: calc(100vh - 54px); }
}

/* ---------------------------------------------------------------- page head, cards */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--navy-500); }
.crumb { font-size: 12.5px; color: var(--navy-500); margin-bottom: 4px; display: block; }
.card { background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--navy-100); }
.card-head p { margin: 2px 0 0; color: var(--navy-500); font-size: 13px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--navy-100); background: var(--navy-50); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .grid-sidebar { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.empty { text-align: center; padding: 48px 20px; color: var(--navy-500); }
.empty .icon { width: 36px; height: 36px; color: var(--navy-300); margin-bottom: 8px; }
.empty h3 { margin-bottom: 4px; }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 16px 18px; }
.stat-label { font-size: 12.5px; color: var(--navy-500); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--navy-900); letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--navy-500); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--navy-300); flex: none; }
.dot-green { background: #22C55E; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.dot-amber { background: #F59E0B; }
.dot-blush { background: var(--blush); }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding: 8px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.chart-bar { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--brand-400), var(--brand-600)); min-height: 3px; position: relative; }
.chart-bar.zero { background: var(--navy-100); }
.chart-num { font-size: 11px; color: var(--navy-500); font-variant-numeric: tabular-nums; }
.chart-label { font-size: 10.5px; color: var(--navy-400); white-space: nowrap; }
@media (max-width: 640px) { .chart-label { display: none; } .chart { gap: 4px; } }
/* Dashboard "Get started": numbered steps, the next one highlighted */
.get-started { margin-bottom: 20px; border-color: var(--brand-100); background: linear-gradient(180deg, var(--brand-50), #fff 120px); }
.get-started .card-head { align-items: center; }
.gs-bar { width: 160px; height: 8px; border-radius: 99px; background: var(--navy-100); overflow: hidden; flex: none; }
.gs-bar span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.gs-steps { list-style: none; margin: 0; padding: 0 20px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.gs-steps li { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--navy-100); border-radius: var(--radius); background: #fff; }
.gs-steps li.next { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .12); }
.gs-steps li.done { opacity: .7; }
.gs-steps strong { display: block; color: var(--navy-900); font-size: 13.5px; }
.gs-steps span:not(.gs-num) { display: block; font-size: 12px; color: var(--navy-500); }
.gs-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 12px; border: 1.5px solid var(--navy-200); color: var(--navy-500); }
.gs-steps li.next .gs-num { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.gs-steps li.done .gs-num { background: var(--green); border-color: var(--green); color: #fff; }
@media (max-width: 640px) { .gs-bar { display: none; } }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--navy-100); background: #fff; color: var(--navy-800); font: inherit; font-weight: 550; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-card); transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--navy-50); border-color: var(--navy-200); text-decoration: none; color: var(--navy-900); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .35); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, var(--brand-500), var(--brand-600)); border-color: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(28, 118, 207, .3); }
.btn-primary:hover { background: linear-gradient(180deg, var(--brand-600), var(--brand-700)); color: #fff; border-color: var(--brand-700); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #B91C1C; color: #fff; border-color: #B91C1C; }
.btn-danger-soft { color: var(--red); border-color: #FECACA; }
.btn-danger-soft:hover { background: var(--red-50); color: #B91C1C; border-color: #FCA5A5; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--navy-700); }
.btn-ghost:hover { background: var(--navy-50); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; gap: 4px; border-radius: 6px; }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-xs { width: 26px; }
.btn .icon { width: 16px; height: 16px; }
.btn-sm .icon, .btn-xs .icon { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label, .label { display: block; font-weight: 600; font-size: 13px; color: var(--navy-900); margin-bottom: 6px; }
.hint { font-size: 12.5px; color: var(--navy-500); margin-top: 5px; }
/* Text fields, dropdowns and text areas: one look everywhere, in the brand colour (a customer's design changes it). */
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--navy-200); border-radius: var(--radius); background: #fff;
  font: inherit; color: var(--navy-800); box-shadow: inset 0 1px 2px rgba(16, 42, 71, .04);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237189A8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--navy-300); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgb(var(--brand-rgb) / .15); }
.input::placeholder, .textarea::placeholder { color: var(--navy-300); }
.input:disabled, .select:disabled, .textarea:disabled, .input:read-only:not(.select):not([type=file]) { background-color: var(--navy-50); color: var(--navy-500); }
.input:disabled, .select:disabled, .textarea:disabled { cursor: not-allowed; }
/* A value the browser finds wrong, once the person has touched the field. */
.input:user-invalid, .select:user-invalid, .textarea:user-invalid { border-color: #FCA5A5; }
.input:user-invalid:focus, .select:user-invalid:focus, .textarea:user-invalid:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgb(220 38 38 / .12); }
/* The open list of a dropdown in the same look (customizable select: Chrome / Edge 135+; other browsers keep their own list). */
@supports (appearance: base-select) {
  .select:not([multiple]):not([size]), .select:not([multiple]):not([size])::picker(select) { appearance: base-select; }
  .select:not([multiple]):not([size]) { display: flex; align-items: center; gap: 8px; padding-right: 12px; background-image: none; }
  .select::picker-icon {
    content: ""; width: 16px; height: 16px; margin-left: auto; flex: none; transition: rotate .15s ease;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237189A8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 16px no-repeat;
  }
  .select:open::picker-icon { rotate: 180deg; }
  /* The chosen option on one line, "..." when long (admin.js adds the button and selectedcontent). */
  .select > button { display: flex; align-items: center; flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: inherit; text-align: left; }
  .select selectedcontent { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .select:open { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgb(var(--brand-rgb) / .15); }
  .select::picker(select) {
    margin-top: 6px; padding: 5px; min-width: anchor-size(width); max-width: min(480px, calc(100vw - 32px)); max-height: min(340px, 60vh); overflow-y: auto;
    background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); box-shadow: var(--shadow-pop);
    opacity: 1; transition: opacity .12s ease, translate .12s ease;
  }
  @starting-style { .select:open::picker(select) { opacity: 0; translate: 0 -4px; } }
  .select option { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13.5px; color: var(--navy-800); cursor: pointer; }
  .select option:hover, .select option:focus-visible { background: var(--navy-50); outline: none; }
  .select option:checked { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
  .select option::checkmark { content: ""; order: 1; margin-left: auto; width: 14px; height: 14px; background: currentColor;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
  .select option:disabled { color: var(--navy-300); cursor: not-allowed; }
  .select optgroup { padding-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--navy-400); }
  .select optgroup + optgroup { margin-top: 4px; border-top: 1px solid var(--navy-100); }
  .select optgroup option { text-transform: none; letter-spacing: 0; font-weight: 400; }
  .select.input-sm option { padding: 7px 9px; font-size: 13px; }
}
.input[type=number] { -moz-appearance: textfield; }
.input[type=number]::-webkit-inner-spin-button { opacity: .45; }
.input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
.input-sm { height: 32px; font-size: 13px; border-radius: var(--radius-sm); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* Checkboxes and radio buttons drawn in the brand colour (the hidden inputs of toggles, chips and cards are left alone). */
input[type=checkbox], input[type=radio] {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; flex: none; display: inline-grid; place-content: center;
  border: 1.5px solid var(--navy-300); background: #fff; cursor: pointer; vertical-align: -4px;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
input[type=checkbox] { border-radius: 5px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::before { content: ""; width: 10px; height: 10px; background: #fff; transform: scale(0); transition: transform .12s ease;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
input[type=radio]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s ease; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--brand-400); }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--brand-600); border-color: var(--brand-600); }
input[type=checkbox]:checked::before, input[type=radio]:checked::before { transform: scale(1); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: none; box-shadow: 0 0 0 4px rgb(var(--brand-rgb) / .2); }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: not-allowed; }

/* File pickers: a dashed box with a real button. */
input[type=file]:not([hidden]):not(.sr-only) {
  width: 100%; max-width: 440px; padding: 6px; font: inherit; font-size: 13px; color: var(--navy-500); cursor: pointer;
  border: 1.5px dashed var(--navy-200); border-radius: var(--radius); background: var(--navy-50); transition: border-color .15s, background-color .15s;
}
input[type=file]:not([hidden]):not(.sr-only):hover { border-color: var(--brand-400); background: var(--brand-50); }
input[type=file]:focus-visible { outline: none; box-shadow: 0 0 0 4px rgb(var(--brand-rgb) / .15); }
input[type=file]::file-selector-button {
  height: 32px; padding: 0 14px; margin-right: 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--navy-800); cursor: pointer;
  border: 1px solid var(--navy-200); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-card); transition: border-color .15s, color .15s;
}
input[type=file]::file-selector-button:hover { border-color: var(--brand-300); color: var(--brand-700); }
input[type=range] { accent-color: var(--brand-600); cursor: pointer; }

.check-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; margin: 0; }
.check-row input { margin-top: 2px; }
.check-row small { display: block; color: var(--navy-500); font-weight: 400; font-size: 12.5px; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.radio-card { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--navy-100); border-radius: var(--radius); cursor: pointer; background: #fff; margin: 0; font-weight: 500; transition: border-color .15s, background .15s; }
.radio-card:hover { border-color: var(--navy-200); }
.radio-card input { margin-top: 2px; }
.radio-card:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .12); }
.radio-card strong { display: block; color: var(--navy-900); }
.radio-card small { display: block; color: var(--navy-500); font-weight: 400; font-size: 12px; }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type="color"] { width: 46px; height: 40px; padding: 4px; border: 1px solid var(--navy-200); border-radius: var(--radius); background: #fff; cursor: pointer; flex: none; }
.color-field input[type="color"]:hover { border-color: var(--navy-300); }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.color-field input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; margin: 0; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 40px; height: 22px; border-radius: 999px; background: var(--navy-200); position: relative; transition: background .2s; flex: none; }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s; }
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .35); }
.file-field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.thumb { width: 52px; height: 52px; border-radius: var(--radius-lg); object-fit: cover; border: 1px solid var(--navy-100); background: var(--navy-50); display: grid; place-items: center; color: var(--navy-300); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- alerts, badges */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--green-50); border-color: #BBF7D0; color: #166534; }
.alert-error { background: var(--red-50); border-color: #FECACA; color: #991B1B; }
.alert-info { background: var(--brand-50); border-color: var(--brand-100); color: var(--navy-700); }
.alert-warn { background: var(--amber-50); border-color: #FDE3A7; color: #7C4A03; }
.alert ul { margin: 0; padding-left: 18px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--navy-50); color: var(--navy-600, var(--navy-700)); border: 1px solid var(--navy-100); white-space: nowrap; }
.badge-bot { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.badge-waiting { background: var(--amber-50); color: var(--amber); border-color: #FDE3A7; }
.badge-open { background: var(--green-50); color: #15803D; border-color: #BBF7D0; }
.badge-closed { background: var(--navy-50); color: var(--navy-500); }
.badge-ai { background: linear-gradient(135deg, #F3E8FF, var(--brand-50)); color: #6D28D9; border-color: #E9D5FF; }
.badge-live { background: var(--green-50); color: #15803D; border-color: #BBF7D0; }
.badge-off { background: var(--navy-50); color: var(--navy-500); }
.badge-blush { background: var(--blush-50); color: #B4524E; border-color: #F6CBC7; }
.badge-admin { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--navy-500); padding: 10px 14px; border-bottom: 1px solid var(--navy-100); background: var(--navy-50); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--navy-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFCFE; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
/* A small form that opens from a table row: <details class="pop"><summary>…</summary><form class="pop-panel">… */
.pop { position: relative; display: inline-block; }
.pop > summary { list-style: none; cursor: pointer; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 260px; padding: 12px; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); box-shadow: 0 12px 32px -8px rgba(16, 42, 71, .22), 0 2px 6px rgba(16, 42, 71, .07); text-align: left; white-space: normal; }
.pop-panel .field { margin-bottom: 10px; }
.field-error { margin-top: 5px; font-size: 12.5px; color: var(--red); }
.cell-main { font-weight: 600; color: var(--navy-900); }
.cell-sub { font-size: 12px; color: var(--navy-500); }
.truncate { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input, .filters .select { width: auto; height: 36px; }
.filters .search { position: relative; flex: 1 1 220px; }
.filters .search .input { width: 100%; padding-left: 34px; }
.filters .search .icon { position: absolute; left: 10px; top: 9px; color: var(--navy-400); }
.pagination { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 14px; }
/* Lists with rows per page (list_pager) and ticks (admin.js: data-bulk). */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--navy-100); }
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager-pages .btn { min-width: 32px; padding: 0 8px; }
.pager-current { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); box-shadow: none; }
.pager-gap { padding: 0 4px; color: var(--navy-400); }
.pager-per label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
.pager-per .select { width: auto; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--brand-50); border-bottom: 1px solid var(--brand-100); border-radius: var(--radius) var(--radius) 0 0; font-size: 13.5px; color: var(--navy-800); }
.bulk-bar > span { flex: 1; }
.table .col-check { width: 40px; padding-right: 0; }
.table tr.selected td { background: var(--brand-50); }
input[type=checkbox]:indeterminate { background: var(--brand-600); border-color: var(--brand-600); }
input[type=checkbox]:indeterminate::before { transform: scale(1); width: 9px; height: 2px; clip-path: none; }
.avatar { position: relative; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand-400), var(--brand-600)); flex: none; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }   /* any photo, cropped to the circle */
.avatar-lg { width: 52px; height: 52px; font-size: 16px; }
.avatar-blush { background: linear-gradient(135deg, #EEADA8, #D07876); }
.avatar-navy { background: linear-gradient(135deg, var(--navy-500), var(--navy-900)); }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--navy-100); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--navy-500); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; font: inherit; font-weight: 600; cursor: pointer; }
.tab:hover { color: var(--navy-900); text-decoration: none; }
.tab.active, .tab[aria-selected="true"] { color: var(--brand-600); border-bottom-color: var(--brand-500); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--navy-50); border: 1px solid var(--navy-100); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: var(--radius-sm); font: inherit; font-size: 13px; font-weight: 600; color: var(--navy-500); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { color: var(--navy-900); }
.seg button[aria-selected="true"] { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-card); }

/* ---------------------------------------------------------------- code blocks */
.code { position: relative; background: var(--navy-950); color: #DCE7F5; border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; font: 12.5px/1.6 var(--mono); white-space: pre; margin: 0; }
.code .c { color: #7189A8; }
.code-wrap { position: relative; }
.code-wrap .copy-btn { position: absolute; top: 8px; right: 8px; }
.copy-btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #DCE7F5; box-shadow: none; }
.copy-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .25); }
.copy-btn.copied { background: var(--green); border-color: var(--green); color: #fff; }
.secret-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--navy-950); color: #fff; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.secret-box code { background: none; border: 0; color: var(--brand-300); padding: 0; flex: 1; }
.endpoint { border: 1px solid var(--navy-100); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; background: #fff; }
.endpoint summary { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; list-style: none; font-weight: 600; }
.endpoint summary::-webkit-details-marker { display: none; }
.endpoint summary:hover { background: var(--navy-50); }
.endpoint[open] summary { border-bottom: 1px solid var(--navy-100); }
.endpoint .ep-body { padding: 14px; }
.method { display: inline-block; min-width: 50px; text-align: center; font: 700 11px/20px var(--mono); border-radius: 5px; color: #fff; }
.method-get { background: var(--brand-600); }
.method-post { background: var(--green); }
.method-delete { background: var(--red); }
.path { font-family: var(--mono); font-size: 13px; color: var(--navy-900); }
.scope { margin-left: auto; }

/* ---------------------------------------------------------------- bots */
.bot-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(480px, 100%), 1fr)); gap: 16px; }   /* wide enough for all the buttons on one line */
.bot-card { display: flex; flex-direction: column; }
.bot-card .card-body { flex: 1; }
.bot-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.bot-icon { width: 44px; height: 44px; border-radius: var(--radius-lg); display: grid; place-items: center; color: #fff; flex: none; overflow: hidden; }
.bot-icon img { width: 100%; height: 100%; object-fit: cover; }
.bot-meta { display: flex; gap: 18px; font-size: 12.5px; color: var(--navy-500); }
.bot-meta strong { display: block; font-size: 18px; color: var(--navy-900); font-weight: 700; }
.bot-links { display: flex; gap: 6px; flex-wrap: wrap; }
@media (min-width: 560px) { .bot-links { flex-wrap: nowrap; } }
.new-bot { margin-top: 20px; }
.template-cards { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.quality { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.file-link { display: inline-flex; align-items: center; gap: 4px; }

/* ---------------------------------------------------------------- flow editor */
.flow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .flow-layout { grid-template-columns: minmax(0, 1fr); } }
.flow-list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step { position: relative; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); margin-bottom: 12px; transition: box-shadow .15s, border-color .15s, opacity .15s; }
.step::after { content: ""; position: absolute; left: 33px; bottom: -13px; width: 2px; height: 12px; background: var(--navy-100); }
.step:last-child::after { display: none; }
.step.dragging { opacity: .45; }
.step.drop-before { box-shadow: 0 -3px 0 var(--brand-500); }
.step.drop-after { box-shadow: 0 3px 0 var(--brand-500); }
.step.open { border-color: var(--brand-100); box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .1), var(--shadow-card); }
.step-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.step-grip { color: var(--navy-300); cursor: grab; display: grid; place-items: center; width: 22px; }
.step-num { width: 26px; height: 26px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.step-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.step-summary { flex: 1; min-width: 0; color: var(--navy-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-tools { display: flex; gap: 2px; }
.step-body { display: none; padding: 4px 16px 16px 48px; border-top: 1px solid var(--navy-50); }
.step.open .step-body { display: block; }
.step-body .field { margin-top: 12px; margin-bottom: 0; }
.t-message { background: var(--brand-500); } .c-message { color: var(--brand-600); }
.t-buttons { background: #8B5CF6; } .c-buttons { color: #7C3AED; }
.t-input { background: #0EA5E9; } .c-input { color: #0284C7; }
.t-handover { background: var(--blush); } .c-handover { color: #C0605B; }
.t-ai { background: linear-gradient(135deg, #8B5CF6, var(--brand-500)); } .c-ai { color: #6D28D9; }
.t-end { background: var(--navy-500); } .c-end { color: var(--navy-500); }
.btn-rows { display: flex; flex-direction: column; gap: 8px; }
.btn-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .btn-row { grid-template-columns: minmax(0, 1fr); } .step-body { padding-left: 16px; } }
.add-steps { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px; border: 1.5px dashed var(--navy-200); border-radius: var(--radius-lg); background: rgba(255, 255, 255, .6); }
.add-steps .label { width: 100%; margin: 0 0 2px; }
.flow-help dt { font-weight: 650; color: var(--navy-900); margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.flow-help dd { margin: 2px 0 0; color: var(--navy-500); font-size: 13px; }
.flow-help .step-num { width: 20px; height: 20px; border-radius: 6px; }

/* ---------------------------------------------------------------- appearance */
.preview-frame { width: 100%; height: 640px; border: 1px solid var(--navy-100); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-card); }
.sticky-col { position: sticky; top: 20px; }

/* ---------------------------------------------------------------- messages (Inbox and the conversation page) */
.msg { display: flex; gap: 8px; max-width: 80%; }
.msg .bubble { padding: 9px 13px; border-radius: var(--radius-lg); background: var(--navy-50); border: 1px solid var(--navy-100); white-space: pre-wrap; word-wrap: break-word; }
.msg .meta { font-size: 11.5px; color: var(--navy-400); margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.msg-visitor { align-self: flex-start; }
.msg-visitor .bubble { background: #fff; border-color: var(--navy-200); border-bottom-left-radius: 4px; }
.msg-bot, .msg-ai, .msg-agent { align-self: flex-end; flex-direction: row-reverse; text-align: left; }
.msg-bot .bubble { background: var(--brand-50); border-color: var(--brand-100); border-bottom-right-radius: 4px; }
.msg-ai .bubble { background: linear-gradient(135deg, #F6F0FF, var(--brand-50)); border-color: #E9D5FF; border-bottom-right-radius: 4px; }
.msg-agent .bubble { background: var(--brand-600); border-color: var(--brand-600); color: #fff; border-bottom-right-radius: 4px; }
.msg-system { align-self: center; max-width: 90%; }
.msg-system .bubble { background: transparent; border: 0; color: var(--navy-500); font-size: 12.5px; padding: 2px 8px; text-align: center; }
.msg img.msg-img { display: block; max-width: 240px; border-radius: var(--radius); margin-top: 6px; }
.msg .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.msg .chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--brand-100); color: var(--brand-700); background: #fff; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--navy-500); }
.kv dd { margin: 0; color: var(--navy-800); word-break: break-word; }

/* ---------------------------------------------------------------- conversation page */
.cv-hero { margin: 6px 0 16px; overflow: hidden; }
.cv-hero-main { display: flex; align-items: center; gap: 16px; padding: 20px 22px; flex-wrap: wrap; background: linear-gradient(120deg, var(--brand-50), #fff 60%); }
.cv-hero-main h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cv-hero-main p { margin: 4px 0 0; color: var(--navy-500); }
.cv-hero-main p b { color: var(--navy-800); font-weight: 600; }
.cv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--navy-100); }
.cv-stats > div { padding: 12px 22px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cv-stats > div + div { border-left: 1px solid var(--navy-100); }
.cv-stats span { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--navy-400); }
.cv-stats b { font-size: 15px; font-weight: 650; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .cv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cv-stats > div:nth-child(3) { border-left: 0; } .cv-stats > div:nth-child(n+3) { border-top: 1px solid var(--navy-100); } }
.cv-thread { display: flex; flex-direction: column; gap: 4px; padding: 20px 22px 24px; background: linear-gradient(180deg, var(--canvas), #fff 260px); border-radius: 0 0 var(--radius) var(--radius); }
.cv-day { display: flex; align-items: center; gap: 12px; margin: 10px 0 6px; font-size: 11.5px; font-weight: 600; color: var(--navy-400); }
.cv-day::before, .cv-day::after { content: ""; flex: 1; border-top: 1px solid var(--navy-100); }
.cv-system { align-self: center; margin: 8px 0; }
.cv-system span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--navy-50); border: 1px solid var(--navy-100); color: var(--navy-500); font-size: 12px; }
.cv-msg { gap: 10px; max-width: 78%; margin-top: 10px; }
.cv-msg.cv-cont { margin-top: 0; }
.cv-msg.cv-cont .cv-av { visibility: hidden; }
.cv-av { width: 30px; height: 30px; font-size: 11px; margin-top: 20px; }
.cv-msg.cv-cont .cv-av { margin-top: 0; height: 0; }
span.cv-av-bot, span.cv-av-ai { display: inline-grid; place-items: center; border-radius: 50%; flex: none; background: var(--brand-50); color: var(--brand-600); border: 1px solid var(--brand-100); }
span.cv-av-ai { background: linear-gradient(135deg, #F3E8FF, var(--brand-50)); color: #6D28D9; border-color: #E9D5FF; }
.cv-inner { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.msg-bot .cv-inner, .msg-ai .cv-inner, .msg-agent .cv-inner { align-items: flex-end; }
.cv-who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--navy-400); margin: 0 4px 4px; }
.cv-who b { color: var(--navy-700); font-weight: 600; }
.cv-who .badge { height: 18px; font-size: 10.5px; padding: 0 6px; }
.cv-msg .bubble { box-shadow: 0 1px 2px rgba(16, 42, 71, .05); }
.cv-msg .bubble > img.msg-img { margin: 0 0 6px; max-width: 220px; }
.cv-msg.cv-cont .bubble { margin-top: 3px; }
/* The side cards' rows (Lead, Visitor): an icon tile, a small label and the value. */
/* The side cards stay in view while the transcript scrolls (they scroll on their own when taller than the window). */
@media (min-width: 1101px) { .cv-side { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; } }
.cv-info { list-style: none; margin: 0; padding: 0; }
.bot-links form { display: contents; }
/* Settings: business hours, one row per day. */
.bh-days { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 6px; }
.bh-day { display: grid; grid-template-columns: 130px 120px auto 120px; align-items: center; gap: 10px; }
.bh-day:not(:has(input[type="checkbox"]:checked)) .input { opacity: .45; }
@media (max-width: 560px) { .bh-day { grid-template-columns: 1fr 1fr auto 1fr; } .bh-day .check-row { grid-column: 1 / -1; } }
/* Bots: "Copy to" dialog - what to copy as tiles, then the bots as a list to tick. */
.copy-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0 18px; }
.copy-part { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--navy-100); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background-color .15s; }
.copy-part:hover { border-color: var(--navy-300); }
.copy-part:has(input:checked) { border-color: var(--brand-400); background: var(--brand-50); }
.copy-part span { display: flex; flex-direction: column; min-width: 0; }
.copy-part b { font-size: 13.5px; color: var(--navy-800); }
.copy-part small { font-size: 12px; color: var(--navy-500); line-height: 1.35; margin-top: 2px; }
.copy-to-head { margin-bottom: 6px; }
.copy-to-head .label { margin: 0; }
.copy-bots { display: flex; flex-direction: column; border: 1px solid var(--navy-100); border-radius: var(--radius); max-height: 300px; overflow-y: auto; }
.copy-bot { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; transition: background-color .15s; }
.copy-bot + .copy-bot { border-top: 1px solid var(--navy-50); }
.copy-bot:hover { background: var(--navy-50); }
.copy-bot:has(input:checked) { background: var(--brand-50); }
.copy-bot .bot-icon { width: 34px; height: 34px; border-radius: 10px; }
.copy-bot .bot-icon svg { width: 18px; height: 18px; }
.copy-bot span.grow { display: flex; flex-direction: column; min-width: 0; }
.copy-bot b { font-size: 13.5px; color: var(--navy-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-bot small { font-size: 12px; color: var(--navy-500); }
@media (max-width: 560px) { .copy-parts { grid-template-columns: minmax(0, 1fr); } }
.cv-info li { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 11px 0; border-top: 1px solid var(--navy-50); }
.cv-info li:first-child { border-top: 0; padding-top: 0; }
.cv-info li:last-child { padding-bottom: 0; }
.cv-info-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--navy-50); color: var(--navy-500); border: 1px solid var(--navy-100); }
.cv-info li > div { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.cv-info li > div > span { font-size: 11.5px; color: var(--navy-500); }
.cv-info b { font-size: 13.5px; font-weight: 600; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-info b.wrap { white-space: normal; word-break: break-word; }
.cv-info b a { font-weight: 600; }
.cv-info b .badge { vertical-align: middle; }

/* ---------------------------------------------------------------- inbox */
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 300px; height: 100vh; background: #fff; }
@media (max-width: 900px) { .inbox { height: calc(100vh - 54px); } }
.ib-col { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--navy-100); }
.ib-col:last-child { border-right: 0; }
.ib-head { padding: 14px 16px; border-bottom: 1px solid var(--navy-100); display: flex; align-items: center; gap: 10px; min-height: 64px; }
.ib-head h2 { font-size: 17px; }
/* The Inbox's lists as small pills that wrap to a second line instead of scrolling out of sight. */
.ib-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--navy-100); }
.ib-tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--navy-100); border-radius: 999px; background: #fff; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--navy-600, var(--navy-700)); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.ib-tab:hover { border-color: var(--navy-200); color: var(--navy-900); }
.ib-tab.active { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
.ib-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--navy-100); color: var(--navy-600, var(--navy-700)); font-size: 11px; display: inline-grid; place-items: center; }
.ib-tab.active .ib-count { background: var(--brand-100); color: var(--brand-700); }
.ib-count.hot { background: var(--blush); color: #fff; }
.ib-search { padding: 10px 12px; border-bottom: 1px solid var(--navy-100); position: relative; }
.ib-search .input { height: 34px; padding-left: 32px; font-size: 13px; }
.ib-search .icon { position: absolute; left: 22px; top: 18px; width: 16px; height: 16px; color: var(--navy-400); }
.ib-list { flex: 1; overflow-y: auto; }
.ib-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--navy-50); cursor: pointer; position: relative; border-left: 3px solid transparent; }
.ib-item:hover { background: var(--navy-50); }
.ib-item.active { background: var(--brand-50); border-left-color: var(--brand-500); }
.ib-item .grow { min-width: 0; }
.ib-av { position: relative; display: flex; flex: none; align-self: flex-start; }
.ib-av .dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border: 2px solid #fff; box-shadow: none; }   /* visitor online */
.ib-name { font-weight: 650; color: var(--navy-900); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-preview { font-size: 12.5px; color: var(--navy-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-item.unread .ib-preview { color: var(--navy-800); font-weight: 600; }
.ib-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.ib-time { font-size: 11px; color: var(--navy-400); white-space: nowrap; }
.ib-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--blush); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.ib-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.ib-tags .badge { height: 18px; font-size: 10.5px; padding: 0 6px; }
.ib-empty { padding: 40px 20px; text-align: center; color: var(--navy-400); font-size: 13px; }
.ib-thread { flex: 1; overflow-y: auto; padding: 20px 22px; background: linear-gradient(180deg, var(--canvas), #fff 300px); display: flex; flex-direction: column; gap: 10px; }
.ib-thread .msg { max-width: 75%; }
.ib-typing { font-size: 12.5px; color: var(--navy-500); padding: 0 22px 6px; height: 22px; display: flex; align-items: center; gap: 8px; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--navy-400); animation: blink 1.2s infinite both; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.composer { border-top: 1px solid var(--navy-100); padding: 12px 14px; background: #fff; }
.composer-box { display: flex; gap: 8px; align-items: flex-end; border: 1px solid var(--navy-200); border-radius: var(--radius-lg); padding: 6px 6px 6px 12px; transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .15); }
.composer textarea { flex: 1; border: 0; resize: none; font: inherit; max-height: 160px; min-height: 24px; padding: 6px 0; outline: none; background: transparent; color: var(--navy-800); }
.composer .hint { margin-top: 6px; }
.composer-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--navy-50); color: var(--navy-600, var(--navy-700)); font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
/* Composer tools (emoji, attach), the file waiting to be sent, and files in messages (Inbox and transcript). */
.composer { position: relative; }
.composer-box { padding-left: 4px; }
.composer-tool { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: none; color: var(--navy-400); cursor: pointer; padding: 0; }
.composer-tool:hover, .composer-tool[aria-expanded="true"] { background: var(--navy-50); color: var(--brand-600); }
.composer-tool:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.composer-tool .icon { width: 19px; height: 19px; }
.composer-att { margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.att-chip { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 7px 7px 8px; border: 1px solid var(--navy-100); border-radius: var(--radius); background: var(--navy-50); overflow: hidden; max-width: 460px; }
.att-chip img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: #fff; }
.att-chip .btn { font-size: 18px; line-height: 1; }
.att-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--brand-500); transition: width .15s; }
.att-error { color: var(--red); font-size: 12.5px; }
.att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.att-meta b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--navy-900); }
.att-meta small { font-size: 11.5px; color: var(--navy-400); }
.att-icon { flex: none; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .03em; color: #fff; background: var(--navy-400); }
.att-pdf .att-icon { background: #E5484D; }
.att-doc .att-icon { background: #2F6FDB; }
.att-image_other .att-icon { background: #22A06B; }
.att-archive .att-icon { background: #B45309; }
.att-media { display: flex; flex-direction: column; gap: 4px; width: 280px; max-width: 100%; }
.att-media audio { width: 100%; height: 40px; }
.att-media video { width: 100%; max-height: 240px; border-radius: 12px; background: #0B1424; }
.att-media-name { font-size: 11.5px; padding: 0 6px 2px; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .bubble.has-att { padding: 4px; max-width: 290px; }
.msg .bubble .att-caption { display: block; padding: 6px 9px 4px; }
.att-img { display: inline-block; vertical-align: top; max-width: min(280px, 100%); border-radius: 12px; overflow: hidden; line-height: 0; background: var(--navy-50); }
.att-img img { display: block; height: auto; max-width: 100%; max-height: 240px; object-fit: cover; }   /* width/height attributes keep the space while it loads */
.att-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; width: 260px; max-width: 100%; border-radius: 12px; background: #fff; color: var(--navy-800); text-decoration: none; white-space: normal; }
.att-file:hover { background: var(--navy-50); text-decoration: none; }
.att-file .icon { color: var(--navy-400); flex: none; }
.msg .bubble.emoji-only { background: none; border-color: transparent; padding: 0 2px; font-size: 30px; line-height: 1.25; }
.msg .bubble.emoji-1 { font-size: 40px; }
.ib-drop { position: absolute; inset: 0; z-index: 5; display: none; place-items: center; align-content: center; gap: 8px; pointer-events: none; background: rgb(255 255 255 / .9); border: 2px dashed var(--brand-500); border-radius: var(--radius-lg); color: var(--brand-700); font-weight: 700; }
.dragging > .ib-drop { display: grid; }
.ib-drop .icon { width: 28px; height: 28px; }
.composer .iem { left: 14px; right: auto; width: 360px; }
.ib-details { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--canvas); }
.ib-details h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--navy-400); margin-bottom: 10px; }
.ib-person { display: flex; align-items: center; gap: 12px; padding: 14px; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); }
.ib-person-name { font-size: 15px; font-weight: 650; color: var(--navy-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-person-status { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12.5px; color: var(--navy-500); }
.ib-person-status .dot { width: 8px; height: 8px; }
.ib-person-status.on { color: #15803D; }
.ib-person-status.on .dot { background: #22C55E; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.ib-card { padding: 12px 14px; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); }
.ib-kv { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px 10px; margin: 0; font-size: 12.5px; }
.ib-kv dt { color: var(--navy-500); }
.ib-kv dd { margin: 0; min-width: 0; color: var(--navy-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-kv dd.wrap { white-space: normal; word-break: break-word; }
.ib-transcript { width: 100%; justify-content: center; }
.ib-placeholder { flex: 1; display: grid; place-items: center; text-align: center; color: var(--navy-400); padding: 24px; }
.ib-placeholder .icon { width: 44px; height: 44px; color: var(--navy-200); margin-bottom: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--navy-100); background: #fff; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--navy-700); }
.status-pill:hover { border-color: var(--navy-200); }
.ib-back { display: none; }
@media (max-width: 1200px) { .inbox { grid-template-columns: 300px minmax(0, 1fr); } .ib-col-details { display: none; } }
@media (max-width: 760px) {
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox.has-conv .ib-col-list { display: none; }
  .inbox:not(.has-conv) .ib-col-thread { display: none; }
  .ib-back { display: inline-flex; }
}

/* ---------------------------------------------------------------- sign-in & bare pages */
.bare { min-height: 100vh; margin: 0; background: radial-gradient(1200px 600px at 10% -10%, rgb(var(--brand-rgb) / .35), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(226, 145, 141, .18), transparent 60%), linear-gradient(160deg, var(--navy-900), var(--navy-950)); }
.auth-center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: var(--radius-lg); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5); padding: 30px 28px; }
.auth-card .brand { padding: 0; margin-bottom: 22px; color: var(--navy-900); --sb-product: var(--brand-600); }
.auth-card .brand-name b { color: var(--brand-600); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-sub { color: var(--navy-500); font-size: 13.5px; margin-bottom: 18px; }
.auth-card .btn-primary { width: 100%; height: 40px; margin-top: 6px; }
.auth-sso { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius); background: var(--brand-50); border: 1px solid var(--brand-100); margin-bottom: 18px; color: var(--navy-700); font-size: 13.5px; }
.auth-sso .icon { color: var(--brand-600); margin-top: 1px; }
.auth-sso strong { display: block; color: var(--navy-900); margin-bottom: 2px; }
.auth-team { border-top: 1px solid var(--navy-100); padding-top: 16px; }
.auth-team > summary { cursor: pointer; font-weight: 600; color: var(--navy-700); list-style: none; display: flex; align-items: center; gap: 8px; }
.auth-team > summary::-webkit-details-marker { display: none; }
.auth-team > summary .icon { transition: transform .15s; }
.auth-team[open] > summary { margin-bottom: 14px; }
.auth-team[open] > summary .icon { transform: rotate(180deg); }
.auth-foot { text-align: center; color: rgba(255, 255, 255, .55); font-size: 12px; margin-top: 18px; }
/* A customer's sign-in page: split screen (brand panel + form) or a centered card on the brand colour */
.bare.branded { background: radial-gradient(900px 520px at 12% -10%, rgb(var(--brand-rgb) / .45), transparent 60%), linear-gradient(160deg, var(--brand-800), var(--brand-900)); }
.bare:has(> .login-split) { background: var(--canvas); }
.login-split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 48px 56px; color: #fff;
  background: radial-gradient(700px 420px at 0% 0%, rgb(255 255 255 / .16), transparent 60%), radial-gradient(520px 420px at 100% 100%, var(--accent), transparent 70%), linear-gradient(150deg, var(--brand-600), var(--brand-900)); }
.auth-hero::after { content: ""; position: absolute; right: -120px; top: 30%; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgb(255 255 255 / .14); box-shadow: 0 0 0 60px rgb(255 255 255 / .04), 0 0 0 120px rgb(255 255 255 / .03); pointer-events: none; }
.auth-hero .brand { padding: 0; color: #fff; --sb-product: rgb(255 255 255 / .8); }
.auth-hero h1 { color: #fff; font-size: 34px; letter-spacing: -.02em; max-width: 440px; }
.auth-hero p { color: rgb(255 255 255 / .82); font-size: 15px; max-width: 420px; margin-top: 12px; }
.auth-hero small { color: rgb(255 255 255 / .6); font-size: 12px; }
.login-split .auth-main { display: grid; place-items: center; padding: 32px 20px; }
.login-split .auth-card { box-shadow: none; background: transparent; padding: 0; max-width: 380px; }
@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 24px; gap: 20px; }
  .auth-hero h1 { font-size: 24px; }
  .auth-hero::after { display: none; }
}
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--navy-900); color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: 13.5px; z-index: 100; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

/* ---------------------------------------------------------------- dialogs */
.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: var(--radius-lg); box-shadow: 0 30px 70px -20px rgba(10, 20, 36, .45); color: var(--navy-700); background: #fff; overflow: hidden; }
.modal[open] { display: flex; }
.modal-sm { width: min(460px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(10, 20, 36, .45); backdrop-filter: blur(2px); }
.modal > form { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--navy-100); }
.modal-head h2 { font-size: 18px; }
.modal-head p { margin: 4px 0 0; color: var(--navy-500); font-size: 13px; }
.modal-body { padding: 18px 22px; overflow-y: auto; min-height: 0; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--navy-100); background: var(--navy-50); }
/* Confirmations (IceAdmin.confirm): the question, Cancel and the action. */
.confirm-modal[open] { flex-direction: column; animation: confirm-in .16s ease; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.confirm-body { display: flex; gap: 14px; padding: 22px 22px 18px; }
.confirm-body h2 { font-size: 17px; margin-bottom: 4px; }
.confirm-body p { margin: 0; font-size: 14px; color: var(--navy-600, var(--navy-700)); line-height: 1.5; }
.confirm-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand-600); }
.confirm-icon svg { width: 20px; height: 20px; }
.confirm-modal.danger .confirm-icon { background: var(--red-50); color: var(--red); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; background: var(--navy-50); border-top: 1px solid var(--navy-100); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-sep { height: 1px; background: var(--navy-100); margin: 16px 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; } }
/* A password with show / generate buttons (admin.js: [data-password]) */
.pw-field { display: flex; gap: 6px; }
.pw-field .input { flex: 1; min-width: 0; font-family: var(--mono); }
.spinner { display: inline-block; width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---------------------------------------------------------------- customers */
.badge-green { background: var(--green-50); color: #15803D; border-color: #BBF7D0; }
.badge-amber { background: var(--amber-50); color: var(--amber); border-color: #FDE3A7; }
.badge-red { background: var(--red-50); color: #B91C1C; border-color: #FECACA; }
.customer-cell { display: flex; gap: 12px; align-items: center; min-width: 0; }
.customer-mark { width: 38px; height: 38px; border-radius: var(--radius); display: grid; place-items: center; flex: none; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--brand-400), var(--brand-600)); }
.limit-list { margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--navy-600); }

.limit-list li { white-space: nowrap; }
.table .actions .row { justify-content: flex-end; gap: 6px; flex-wrap: wrap; max-width: 300px; margin-left: auto; }
.dns-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; padding: 12px 20px; border-top: 1px solid var(--navy-100); color: var(--navy-500); font-size: 12.5px; }
.dns-note .icon { color: var(--brand-600); }

/* ---------------------------------------------------------------- limits (a customer app's plan) */
.limit-warn { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; margin-bottom: 18px; border: 1px solid #FDE68A; border-radius: var(--radius); background: linear-gradient(180deg, var(--amber-50), #fff); }
.limit-warn h2 { font-size: 15px; margin: 0 0 3px; }
.limit-warn p { margin: 0; color: var(--navy-600); }
.limit-warn-icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius); background: #FEF3C7; color: var(--amber); }

/* ---------------------------------------------------------------- your profile */
.profile-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-card { overflow: hidden; text-align: center; }
.profile-cover { height: 92px; background: radial-gradient(160px 90px at 20% 0%, rgb(255 255 255 / .35), transparent 70%), linear-gradient(120deg, var(--brand-500), var(--accent)); }
.profile-body { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 22px 22px; margin-top: -48px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; border: 4px solid #fff; box-shadow: 0 12px 28px -12px rgb(var(--brand-rgb) / .7); margin-bottom: 8px; }
.profile-body h2 { margin: 0; font-size: 17px; }
.profile-body p { margin: 0 0 10px; }
.profile-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.profile-body .hint { margin-top: 10px; max-width: 260px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--brand-400); outline-offset: 1px; }
.side-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.input.invalid, .select.invalid { border-color: #FCA5A5; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- settings: a section per topic, title and explanation beside it */
.set-section { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--navy-100); }
.set-section:first-child { border-top: 0; padding-top: 4px; }
.set-intro { display: flex; gap: 12px; align-items: flex-start; }
.set-icon { width: 34px; height: 34px; border-radius: var(--radius); display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand-600); }
.set-intro h3 { font-size: 15px; margin-top: 6px; }
.set-intro p { margin: 4px 0 0; font-size: 12.5px; color: var(--navy-500); line-height: 1.5; }
.set-body { min-width: 0; max-width: 560px; }
.rt-status { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; font-size: 13px; font-weight: 600; }
.rt-status .dot { margin-top: 6px; }
.field-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-inline label { margin: 0; }
.field-inline .input { width: 110px; }
.settings-save { display: flex; align-items: center; gap: 12px; padding-top: 20px; border-top: 1px solid var(--navy-100); }
.plan-card { background: linear-gradient(170deg, var(--brand-50), #fff 55%); }
.plan-list { list-style: none; margin: 0; display: grid; gap: 16px; }
.plan-row { display: flex; gap: 11px; align-items: flex-start; }
.plan-row > div { flex: 1; min-width: 0; }
.plan-icon, .stat-icon { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--radius-sm); background: #fff; color: var(--brand-600); border: 1px solid var(--navy-100); box-shadow: var(--shadow-card); }
.plan-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--navy-600); }
.plan-line strong { color: var(--navy-900); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-line small { font-weight: 500; color: var(--navy-400); }
.plan-bar { display: block; height: 6px; margin-top: 7px; border-radius: 999px; background: var(--navy-100); overflow: hidden; }
.plan-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-400), var(--brand-600)); }
.plan-row.full .plan-bar i { background: linear-gradient(90deg, #D97706, var(--red)); }
.plan-row.full .plan-line strong { color: #B91C1C; }
.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-pair > div { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--navy-100); border-radius: var(--radius); background: var(--navy-50); min-width: 0; }
.stat-pair .stat-icon { margin-bottom: 6px; }
.stat-pair strong { font-size: 17px; color: var(--navy-900); }
.stat-pair small { color: var(--navy-500); font-size: 12px; }
@media (max-width: 860px) { .set-section { grid-template-columns: minmax(0, 1fr); gap: 12px; } }

/* ---------------------------------------------------------------- design page (Customers → Design) */
.design { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.design-settings > .card + .card { margin-top: 16px; }
.design-side { align-self: stretch; }   /* the full height of the form, so the preview inside can stick */
.design-sticky { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 12px; }
.design-actions { display: flex; justify-content: flex-end; gap: 8px; }
.seg-radios { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: var(--radius); }
.seg-radio { position: relative; cursor: pointer; margin: 0; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; color: var(--navy-500); }
.seg-radio input:checked + span { background: #fff; color: var(--brand-700); box-shadow: 0 1px 2px rgba(16, 42, 71, .12); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--brand-400); }
.color-field .input { text-transform: uppercase; font-family: var(--mono); }
.logo-field { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.logo-box { width: 120px; height: 64px; flex: none; display: grid; place-items: center; border: 1px dashed var(--navy-200); border-radius: var(--radius); background: repeating-conic-gradient(#F3F6FA 0% 25%, #fff 0% 50%) 50% / 14px 14px; color: var(--navy-300); overflow: hidden; }
.logo-box img { max-width: 108px; max-height: 52px; object-fit: contain; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.preset { position: relative; cursor: pointer; margin: 0; font-weight: 500; }
.preset input { position: absolute; opacity: 0; pointer-events: none; }
.preset-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--navy-100); border-radius: var(--radius-lg); background: #fff; transition: border-color .12s, box-shadow .12s; }
.preset-card strong { font-size: 12.5px; color: var(--navy-800); padding: 0 2px 2px; }
.preset input:checked + .preset-card { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .16); }
.preset input:focus-visible + .preset-card { outline: 2px solid var(--brand-400); }
.preset-swatch { display: grid; grid-template-columns: 30% 1fr; height: 52px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--navy-100); }
.preset-swatch i { display: flex; align-items: flex-end; gap: 4px; padding: 6px; }
.preset-swatch b { width: 14px; height: 14px; border-radius: 4px; }
.preset-custom { display: grid; grid-template-columns: 1fr; place-items: center; color: var(--navy-400); background: var(--navy-50); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; display: block; cursor: pointer; margin: 0; font-weight: 500; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px; border: 1px solid var(--navy-100); border-radius: var(--radius); background: #fff; transition: border-color .12s, box-shadow .12s; }
.choice strong { font-size: 13px; color: var(--navy-900); }
.choice small { font-size: 11.5px; color: var(--navy-500); line-height: 1.4; }
.choice:hover > span { border-color: var(--brand-300); }
.choice input:checked + span { border-color: var(--brand-500); background: var(--brand-50); box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .14); }
.choice input:focus-visible + span { outline: 2px solid var(--brand-300); }
@media (max-width: 1180px) { .design { grid-template-columns: minmax(0, 1fr); } .design-side { order: -1; } .design-sticky { position: static; } }

/* Live preview: a small dashboard / sign-in page drawn with the design's variables (assets/design.js) */
.design-preview { border: 1px solid var(--navy-100); border-radius: var(--radius-lg); overflow: hidden; background: var(--canvas); font-family: var(--font); box-shadow: var(--shadow-card); }
.pv-app { display: grid; grid-template-columns: 140px 1fr; min-height: 300px; }
.pv-sidebar { background: var(--sb-bg); color: var(--sb-text); border-right: 1px solid var(--sb-border); padding: 12px 8px; display: flex; flex-direction: column; gap: 3px; }
.pv-brand { display: flex; align-items: center; gap: 7px; padding: 2px 4px 10px; color: var(--sb-strong); min-width: 0; }
.pv-brand > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.pv-brand strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-brand small { font-size: 8.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sb-product); }
.pv-logo { width: 24px; height: 24px; flex: none; border-radius: var(--radius-sm); display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; font-size: 12px; font-weight: 800; }
.pv-logo.has-img { width: auto; max-width: 56px; background: none; }
.pv-logo img { max-height: 24px; max-width: 56px; object-fit: contain; }
.pv-nav { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 7px; border-radius: var(--radius-sm); font-size: 11px; color: var(--sb-text); }
.pv-nav .icon-sm { width: 12px; height: 12px; color: var(--sb-muted); }
.pv-nav.active { background: var(--sb-active-bg); color: var(--sb-active-text); box-shadow: inset 2px 0 0 var(--sb-active-bar); font-weight: 600; }
.pv-nav.active .icon-sm { color: var(--sb-active-icon); }
.pv-main { padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pv-title { font-size: 15px; color: var(--navy-900); }
.pv-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv-kpi { display: flex; flex-direction: column; gap: 2px; padding: 8px 9px; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); }
.pv-kpi small { font-size: 9px; color: var(--navy-500); font-weight: 600; }
.pv-kpi b { font-size: 15px; color: var(--navy-900); }
.pv-kpi i { font-style: normal; font-size: 9px; font-weight: 700; color: #15803D; }
.pv-chart { display: flex; align-items: flex-end; gap: 5px; height: 70px; padding: 8px; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); }
.pv-chart i { flex: 1; border-radius: 3px 3px 1px 1px; background: linear-gradient(180deg, var(--brand-400), var(--brand-600)); }
.pv-chat { display: flex; flex-direction: column; gap: 4px; padding: 8px; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); font-size: 9.5px; }
.pv-chat span { max-width: 80%; padding: 4px 7px; border-radius: 9px; background: var(--navy-50); color: var(--navy-700); }
.pv-chat span.me { align-self: flex-end; background: var(--brand-600); color: #fff; }
.pv-buttons { display: flex; gap: 6px; }
.pv-btn { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: var(--radius-sm); font-size: 10px; font-weight: 700; color: #fff; background: linear-gradient(180deg, var(--brand-500), var(--brand-700)); }
.pv-btn.ghost { background: #fff; color: var(--navy-800); border: 1px solid var(--navy-200); }
.compact .pv-main { padding: 10px; gap: 6px; }
.compact .pv-kpi { padding: 6px 8px; }
.pv-login { display: grid; grid-template-columns: 1fr 1fr; min-height: 300px; }
.pv-hero { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 16px; color: #fff;
  background: radial-gradient(260px 160px at 100% 100%, var(--accent), transparent 70%), linear-gradient(150deg, var(--brand-600), var(--brand-900)); }
.pv-hero .pv-brand { color: #fff; --sb-product: rgb(255 255 255 / .8); padding: 0 0 6px; }
.pv-hero b { font-size: 15px; line-height: 1.2; }
.pv-hero small { font-size: 10px; color: rgb(255 255 255 / .8); }
.pv-form { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 16px; background: #fff; }
.pv-form b { font-size: 13px; color: var(--navy-900); }
.pv-form i { height: 22px; border: 1px solid var(--navy-200); border-radius: var(--radius-sm); }
.pv-form .pv-btn { justify-content: center; }
.pv-centered .pv-login { grid-template-columns: 1fr; place-items: center; padding: 20px; background: radial-gradient(260px 180px at 10% 0%, rgb(var(--brand-rgb) / .45), transparent 60%), linear-gradient(160deg, var(--brand-800), var(--brand-900)); }
.pv-centered .pv-hero { display: none; }
.pv-centered .pv-form { width: 70%; border-radius: var(--radius-lg); box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .5); }

/* ---------------------------------------------------------------- a customer's design (branding.php: body.branded …) */
/* Customers get a calmer page: more room, larger titles, softer cards. */
.branded .content { padding: 34px 40px 60px; }
.branded .page-head h1 { font-size: 26px; letter-spacing: -.02em; }
.branded .card { border-color: rgb(var(--brand-rgb) / .10); box-shadow: 0 1px 2px rgba(16, 42, 71, .04), 0 8px 24px -16px rgba(16, 42, 71, .18); }
.branded .stats, .branded .grid { gap: 20px; }
.sidebar-light .sidebar { box-shadow: 1px 0 0 var(--navy-100); }
.density-compact .content { padding: 20px 24px 40px; }
.density-compact .page-head { margin-bottom: 14px; }
.density-compact .card-head { padding: 11px 16px; }
.density-compact .card-body { padding: 14px 16px; }
.density-compact .table th, .density-compact .table td { padding: 7px 12px; }
.density-compact .stats, .density-compact .grid { gap: 12px; }
.density-compact .stat { padding: 12px 14px; }
.density-compact .nav-link { padding: 6px 10px; }
@media (max-width: 640px) { .branded .content { padding: 20px 16px 40px; } }

/* ---------------------------------------------------------------- animation (Design → Animation: body.motion-*; the preview uses the same classes) */
.motion-demo { display: flex; align-items: flex-end; gap: 4px; height: 30px; margin-bottom: 8px; }
.motion-demo i { width: 14px; border-radius: 4px; background: var(--brand-400); }
.motion-demo i:nth-child(1) { height: 40%; } .motion-demo i:nth-child(2) { height: 75%; } .motion-demo i:nth-child(3) { height: 100%; }
.motion-demo-none i { background: var(--navy-200); }
@keyframes ic-fade { from { opacity: 0; } }
@keyframes ic-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes ic-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes ic-grow-y { from { transform: scaleY(0); } }
@keyframes ic-glow { 50% { box-shadow: inset 3px 0 0 var(--sb-active-bar), 0 0 18px -4px rgb(var(--brand-rgb) / .55); } }
@keyframes ic-shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }
@keyframes ic-demo { 0%, 15% { transform: scaleY(.2); opacity: .4; } 45%, 100% { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  /* the choice cards show their own motion */
  .motion-demo-subtle i { animation: ic-fade 1.6s ease-in-out infinite alternate; }
  .motion-demo-smooth i, .motion-demo-lively i { transform-origin: bottom; animation: ic-demo 1.8s cubic-bezier(.2, .8, .2, 1) infinite alternate; }
  .motion-demo-smooth i:nth-child(2), .motion-demo-lively i:nth-child(2) { animation-delay: .15s; }
  .motion-demo-smooth i:nth-child(3), .motion-demo-lively i:nth-child(3) { animation-delay: .3s; }
  .motion-demo-lively i { background: linear-gradient(180deg, var(--accent), var(--brand-500)); }

  /* Subtle: the page fades in */
  .motion-subtle .content, .motion-subtle .pv-main { animation: ic-fade .45s ease-out backwards; }

  /* Smooth and Lively: blocks rise one after another, the chart bars grow */
  :is(.motion-smooth, .motion-lively) :is(.content > *, .stats > *, .grid > *, .stack > *, .pv-main > *) { animation: ic-rise .55s cubic-bezier(.2, .8, .2, 1) backwards; }
  :is(.motion-smooth, .motion-lively) :is(.content, .stats, .grid, .stack, .pv-main, .pv-kpis) > :nth-child(2) { animation-delay: .06s; }
  :is(.motion-smooth, .motion-lively) :is(.content, .stats, .grid, .stack, .pv-main, .pv-kpis) > :nth-child(3) { animation-delay: .12s; }
  :is(.motion-smooth, .motion-lively) :is(.content, .stats, .grid, .stack, .pv-main, .pv-kpis) > :nth-child(4) { animation-delay: .18s; }
  :is(.motion-smooth, .motion-lively) :is(.content, .stats, .grid, .stack, .pv-main, .pv-kpis) > :nth-child(5) { animation-delay: .24s; }
  :is(.motion-smooth, .motion-lively) :is(.content, .stats, .grid, .stack, .pv-main, .pv-kpis) > :nth-child(n+6) { animation-delay: .3s; }
  :is(.motion-smooth, .motion-lively) .pv-kpis > * { animation: ic-pop .5s cubic-bezier(.2, .8, .2, 1) backwards; }
  :is(.motion-smooth, .motion-lively) :is(.chart-bar, .pv-chart i) { transform-origin: bottom; animation: ic-grow-y .8s .35s cubic-bezier(.2, .8, .2, 1) backwards; }
  :is(.motion-smooth, .motion-lively) .nav-link { transition: background .2s, color .2s, padding-left .2s; }

  /* Lively: hover lift, a shine on primary buttons, a glowing active menu item */
  .motion-lively :is(.card, .stat, .pv-kpi) { transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s; }
  .motion-lively :is(.stat, .pv-kpi, .bot-card):hover { transform: translateY(-3px); box-shadow: 0 14px 30px -14px rgb(var(--brand-rgb) / .45), var(--shadow-card); }
  .motion-lively .nav-link:hover { padding-left: 16px; }
  .motion-lively .nav-link.active, .motion-lively .pv-nav.active { animation: ic-glow 2.8s ease-in-out infinite; }
  .motion-lively :is(.btn-primary, .pv-btn:not(.ghost)) { position: relative; overflow: hidden; }
  .motion-lively :is(.btn-primary, .pv-btn:not(.ghost))::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); transform: translateX(-120%) skewX(-20deg); }
  .motion-lively .btn-primary:hover::after, .motion-lively .pv-btn:not(.ghost)::after { animation: ic-shine .9s ease-out; }
}

/* ---------------------------------------------------------------- departments, agents and routing (routing.php) */
fieldset.field { border: 0; padding: 0; min-width: 0; }
fieldset.field > legend { padding: 0; }
.dept-chip { --dept: var(--brand-500); display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  color: var(--navy-800); background: color-mix(in srgb, var(--dept) 12%, #fff); border: 1px solid color-mix(in srgb, var(--dept) 35%, #fff); vertical-align: middle; }
.dept-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--dept); flex: none; }
.ib-tags .dept-chip { height: 18px; font-size: 10.5px; padding: 0 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.check-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.check-chip { --dept: var(--navy-300); position: relative; display: inline-flex; margin: 0; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip span { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--navy-100); background: #fff; color: var(--navy-700); transition: border-color .15s, background .15s; }
.check-chip span i { width: 8px; height: 8px; border-radius: 50%; background: var(--dept); }
.check-chip:hover span { border-color: var(--navy-200); }
.check-chip input:checked + span { border-color: var(--brand-500); background: var(--brand-50); color: var(--navy-900); }
.check-chip input:checked + span::before { content: "\2713"; font-size: 11px; color: var(--brand-600); }
.check-chip input:focus-visible + span { box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .3); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; margin: 0; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span { display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--dept); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); transition: transform .15s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--dept); transform: scale(1.05); }
.swatch input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: 4px; }
.team-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: -8px 0 16px; font-size: 13px; color: var(--navy-700); }
.team-stats > span { display: inline-flex; align-items: center; gap: 7px; }
.team-stats .icon { width: 15px; height: 15px; }
.team-table td { vertical-align: middle; }
.row-off { opacity: .6; }
.dept-card { border-top: 3px solid var(--dept); }
.dept-card .card-head h2 { font-size: 16px; }
.dept-mark { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--dept); }
.dept-body { display: grid; gap: 12px; }
.dept-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--navy-600, var(--navy-700)); }
.dept-facts > span { display: inline-flex; align-items: center; gap: 6px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 3px; border-radius: 999px; background: var(--navy-50); border: 1px solid var(--navy-100); font-size: 12.5px; font-weight: 600; color: var(--navy-800); }
.person-chip.off { opacity: .55; }
.person-chip .dot { width: 7px; height: 7px; }
.avatar-xs { width: 22px; height: 22px; font-size: 9.5px; }
.route-steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; counter-reset: route; }
.route-steps li { position: relative; padding: 10px 12px 10px 42px; border: 1px solid var(--navy-100); border-radius: var(--radius); background: var(--navy-50); counter-increment: route; font-size: 13px; }
.route-steps li::before { content: counter(route); position: absolute; left: 12px; top: 10px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-500); color: #fff; font-size: 11px; font-weight: 700; }
.route-steps small { display: block; color: var(--navy-500); font-weight: 400; font-size: 12.5px; margin-top: 2px; }
.route-steps .check-row input { margin-top: 2px; }
.ib-search { display: flex; gap: 8px; }
.ib-search .input { flex: 1; min-width: 0; }
.ib-search .select { width: auto; max-width: 58%; flex: none; height: 34px; font-size: 13px; padding-left: 10px; }
.ib-cap { font-size: 12px; font-weight: 600; color: var(--navy-500); white-space: nowrap; }
.ib-cap.full { color: var(--amber); }
#ib-subtitle .dept-chip { height: 18px; font-size: 10.5px; padding: 0 6px; }

/* Attachment settings (views/_attachments.php), plan notes and modal sub-headings. */
.hint-warn { display: flex; align-items: flex-start; gap: 6px; color: #B45309; }
.hint-warn .icon { flex: none; margin-top: 2px; }
.hint-warn[hidden] { display: none; }
.check-list { display: grid; gap: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 18px; }
.check-grid code { font-size: 10.5px; color: var(--navy-500); background: var(--navy-50); padding: 1px 5px; border-radius: 4px; }
.check-risky small { color: #B45309; }
.check-custom { grid-column: 1 / -1; cursor: default; }
.check-custom > span { flex: 1; min-width: 0; }
.check-custom label { display: inline; margin: 0; font-weight: 600; cursor: pointer; }
.check-custom .input { display: block; max-width: 360px; margin-top: 8px; }
.modal .check-grid { grid-template-columns: minmax(0, 1fr); }
.check-list > legend { font-weight: 600; font-size: 13px; color: var(--navy-700); margin-bottom: 8px; }
.plan-note { font-size: 12px; color: var(--navy-500); margin-top: 3px; }
.modal-sub { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--navy-100); }
.stat-pair > div:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- contacts (identified users, contacts.php) */
.attr-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.attr-chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; white-space: nowrap;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--navy-800); background: var(--navy-50); border: 1px solid var(--navy-100); }
.attr-chip b { font-weight: 600; color: var(--navy-500); }
.file-list, .device-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.file-list li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ib-customer { border: 1px solid var(--navy-100); border-radius: var(--radius); padding: 12px 14px; background: #fff; }
.ib-customer .ib-customer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ib-customer .ib-customer-head h3 { margin: 0; }
.ib-customer .attr-chips { margin: 8px 0 0; }
.ib-customer .ib-customer-link { display: inline-block; margin-top: 8px; font-size: 12.5px; font-weight: 600; }
.kv-tight { grid-template-columns: 90px minmax(0, 1fr); gap: 3px 10px; font-size: 12.5px; }

/* Embed & API -> Documentation: the generated guide, rendered (views/embed.php, lib/docs.php) */
.btn-big { height: 44px; padding: 0 20px; font-size: 15px; }
.docs-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.docs-meta { display: flex; flex-direction: column; gap: 2px; margin-left: 6px; min-width: 0; }
.docs-meta .mono { color: var(--navy-800); word-break: break-all; }
.docs-view { display: grid; grid-template-columns: 220px minmax(0, 1fr); border: 1px solid var(--navy-100); border-radius: var(--radius); height: 760px; overflow: hidden; background: #fff; }
.docs-toc { border-right: 1px solid var(--navy-100); background: var(--navy-50); padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.docs-toc .label { padding: 0 8px; margin-bottom: 6px; }
.docs-toc a { padding: 6px 8px; border-radius: var(--radius-sm); color: var(--navy-700); font-size: 13px; font-weight: 550; line-height: 1.35; }
.docs-toc a:hover { background: #fff; color: var(--brand-700); text-decoration: none; }
.docs-body { padding: 8px 28px 28px; overflow-y: auto; font-size: 14px; line-height: 1.65; color: var(--navy-800); scroll-behavior: smooth; }
.docs-body h1 { font-size: 22px; margin: 18px 0 10px; }
.docs-body h2 { font-size: 18px; margin: 30px 0 10px; padding-top: 14px; border-top: 1px solid var(--navy-100); }
.docs-body h1 + blockquote + h2, .docs-body > h2:first-child { border-top: 0; }
.docs-body h3 { font-size: 15.5px; margin: 22px 0 8px; }
.docs-body h4 { font-size: 14px; margin: 18px 0 6px; color: var(--navy-900); }
.docs-body p, .docs-body ul, .docs-body ol { margin: 0 0 10px; }
.docs-body ul, .docs-body ol { padding-left: 22px; }
.docs-body li { margin: 2px 0; }
.docs-body code { font: 12.5px var(--mono); background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: 5px; padding: 0 4px; }
.docs-body pre.code { margin: 6px 0 14px; white-space: pre; }
.docs-body blockquote { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--brand-500); background: var(--brand-50); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--navy-700); }
.docs-body .table-wrap { border: 1px solid var(--navy-100); border-radius: var(--radius-sm); margin: 6px 0 14px; }
.docs-body .table td { vertical-align: top; padding: 8px 12px; font-size: 13px; }
.docs-body .table th { padding: 8px 12px; }
@media (max-width: 900px) { .docs-view { grid-template-columns: minmax(0, 1fr); height: auto; } .docs-toc { display: none; } .docs-body { max-height: 80vh; padding: 4px 16px 20px; } }

.cv-team { display: flex; flex-direction: column; gap: 8px; }
.cv-team .ib-taglist { margin: 0; }
.cv-rating { margin: 0; font-size: 13.5px; }
/* Bot settings: knowledge from a website or a PDF. */
.kn-import { padding: 14px; border: 1px dashed var(--navy-200); border-radius: var(--radius); background: var(--navy-50); }
.kn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.kn-row .grow { min-width: 220px; }
.kn-row .check-row { white-space: nowrap; font-size: 13px; }
/* Bot settings: proactive messages, one row each. */
.trigger-rows { display: flex; flex-direction: column; gap: 8px; }
.trigger-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 90px minmax(0, 1.6fr); gap: 8px; align-items: center; }
.trigger-head span { font-size: 12px; font-weight: 600; color: var(--navy-500); }
@media (max-width: 760px) { .trigger-row { grid-template-columns: 1fr 1fr; } .trigger-head { display: none; } }
/* Replies & tags page. */
.reply-grid { grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--navy-200); border-radius: var(--radius); background: #fff; }
.input-prefix span { padding-left: 12px; color: var(--navy-400); font-weight: 600; }
.input-prefix .input { border: 0; box-shadow: none; padding-left: 4px; }
.input-prefix:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgb(var(--brand-rgb) / .15); }
.reply-list { display: flex; flex-direction: column; }
.reply-item { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 20px; border-top: 1px solid var(--navy-50); }
.reply-item code { font-weight: 600; color: var(--brand-700); }
.reply-item p { margin: 0; font-size: 13.5px; color: var(--navy-700); white-space: pre-wrap; word-break: break-word; }
.reply-item form { display: contents; }
.tag-admin { display: flex; flex-direction: column; gap: 6px; }
.tag-admin-row { display: flex; align-items: center; gap: 10px; }
.tag-admin-row a { margin-left: auto; }
@media (max-width: 700px) { .reply-grid, .reply-item { grid-template-columns: minmax(0, 1fr); } }
/* Inbox: tags, internal notes and saved replies (inbox.js). */
.ib-stack { display: flex; flex-direction: column; gap: 12px; }
.ib-search .select { max-width: 34%; }
.ib-taglist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ib-tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 4px 0 9px; border-radius: 999px; background: var(--navy-50); border: 1px solid var(--navy-100); font-size: 12px; font-weight: 600; color: var(--navy-700); }
.ib-tag i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ib-tag button { width: 18px; height: 18px; border: 0; border-radius: 50%; background: none; color: var(--navy-400); font-size: 14px; line-height: 1; padding: 0; cursor: pointer; }
.ib-tag button:hover { background: var(--navy-100); color: var(--navy-800); }
.ib-tags .ib-tag { height: 18px; font-size: 10.5px; padding: 0 7px; }
.ib-inline-form { display: flex; gap: 6px; }
.ib-inline-form .input { flex: 1; min-width: 0; height: 32px; font-size: 13px; }
.ib-hint { margin: -4px 0 10px; font-size: 12px; color: var(--navy-500); }
.ib-notelist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ib-note-item { padding: 9px 11px; border-radius: var(--radius); background: #FFF8E6; border: 1px solid #F8E3B0; }
.ib-note-item p { margin: 0; font-size: 13px; color: var(--navy-800); white-space: pre-wrap; word-break: break-word; }
.ib-note-item small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--navy-500); }
.ib-note-form { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.ib-note-form .textarea { min-height: 60px; font-size: 13px; }
.ib-replies { position: absolute; left: 14px; right: 14px; bottom: calc(100% - 4px); max-height: 260px; overflow-y: auto; padding: 5px; background: #fff; border: 1px solid var(--navy-100); border-radius: var(--radius); box-shadow: var(--shadow-pop); z-index: 5; }
.ib-reply { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; color: var(--navy-800); cursor: pointer; }
.ib-reply b { font-size: 12.5px; color: var(--brand-700); }
.ib-reply span { font-size: 12.5px; color: var(--navy-600, var(--navy-700)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-reply.on, .ib-reply:hover { background: var(--brand-50); }
.ib-reply-empty { padding: 8px 10px; font-size: 13px; color: var(--navy-500); }
.ib-replies a { display: block; padding: 4px 10px 8px; font-size: 13px; }

/* Knowledge (RAG) page. */
.kn-hero { display: flex; align-items: center; gap: 18px; padding: 22px 24px; margin-bottom: 18px; background: linear-gradient(120deg, #fff 55%, var(--brand-50)); }
.kn-hero h1 { font-size: 22px; }
.kn-hero p { margin: 6px 0 0; color: var(--navy-500); max-width: 720px; }
.kn-hero-icon { width: 54px; height: 54px; flex: none; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--brand-500), var(--brand-700)); box-shadow: 0 10px 22px -10px rgb(var(--brand-rgb) / .7); }
.kn-hero-icon .icon { width: 26px; height: 26px; }
.kn-status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.kn-status small { font-size: 12px; color: var(--navy-500); }
.kn-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--navy-50); border: 1px solid var(--navy-100); color: var(--navy-600, var(--navy-700)); }
.kn-pill.on { background: #EAFBF0; border-color: #BBF0CF; color: #15803D; }
.kn-warn { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); background: #FFF8E6; border: 1px solid #F8E3B0; font-size: 13px; }
.kn-warn-page { margin: 0 0 18px; }
.kn-bots { display: flex; flex-direction: column; }
.kn-bot { display: grid; grid-template-columns: 38px minmax(0, 1fr) minmax(200px, 280px) auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--navy-50); }
.kn-bot-ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--navy-50); color: var(--navy-400); }
.kn-bot.on .kn-bot-ico { background: var(--brand-50); color: var(--brand-600); }
.kn-bot-name { display: flex; flex-direction: column; min-width: 0; }
.kn-bot-name b { font-size: 14px; color: var(--navy-900); }
.kn-bot-name small { font-size: 12px; color: var(--navy-500); }
.kn-passages { display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 12.5px; color: var(--navy-500); }
.kn-passages .input { width: 64px; }
.kn-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; text-align: center; color: var(--navy-500); font-size: 13px; }
.kn-empty .icon { width: 26px; height: 26px; color: var(--navy-300); }
.kn-empty b { color: var(--navy-800); }
.kn-flow { display: flex; flex-direction: column; }
.kn-flow > div { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; padding-bottom: 16px; }
.kn-flow > div:last-child { padding-bottom: 0; }
.kn-flow > div:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 2px; width: 2px; background: var(--navy-100); }
.kn-flow span { grid-row: span 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-50); color: var(--brand-600); }
.kn-flow span .icon { width: 17px; height: 17px; }
.kn-flow b { font-size: 13.5px; color: var(--navy-900); padding-top: 2px; }
.kn-flow small { font-size: 12.5px; color: var(--navy-500); }
.kn-notes ul { margin: 0; padding: 16px 20px 16px 36px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--navy-700); }
/* The knowledge bases (list) and one knowledge base: its documents and Try it. */
.kb-list { display: flex; flex-direction: column; }
.kb-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--navy-50); color: inherit; }
.kb-item:hover { background: #FAFCFE; text-decoration: none; }
.kb-item-name { display: flex; flex-direction: column; min-width: 0; }
.kb-item-name b { font-size: 14px; color: var(--navy-900); }
.kb-item-name small { font-size: 12px; color: var(--navy-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-item-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--navy-500); white-space: nowrap; }
.kb-item-stats b { color: var(--navy-800); }
.kb-stale { align-items: center; }
.kb-error { max-width: 260px; color: #B91C1C; }
.kb-try:not(:empty) { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.kb-try .hint { margin: 0; }
.kb-answer { padding: 12px 14px; border-radius: var(--radius); background: var(--brand-50); border: 1px solid var(--brand-100); }
.kb-answer small { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-700); }
.kb-answer p { margin: 4px 0 0; white-space: pre-wrap; }
.kb-source { padding: 10px 12px; border: 1px solid var(--navy-100); border-radius: var(--radius); }
.kb-source header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-size: 13px; }
.kb-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.kb-text { margin: 6px 0 0; font-size: 13px; color: var(--navy-700); white-space: pre-wrap; max-height: 7.5em; overflow: hidden; }
.kb-source.open .kb-text { max-height: none; }
@media (max-width: 760px) {
  .kn-hero { flex-wrap: wrap; } .kn-status { align-items: flex-start; text-align: left; }
  .kn-bot { grid-template-columns: 38px minmax(0, 1fr); } .kn-bot select, .kn-passages { grid-column: 2; }
  .kb-item { grid-template-columns: 38px minmax(0, 1fr); } .kb-item-stats, .kb-item .badge { grid-column: 2; justify-self: start; }
}
