    :root {
      --sidebar-bg: #F3F5F8;
      --sidebar-active-bg: #E1E7EF;
      --sidebar-text: #0F1B2D;
      --sidebar-inactive: #2A3850;
      --sidebar-group-label: #6B778A;
      --sidebar-border: #E2E6EC;
      --rail-bg: #0B2239;
      --rail-active: #133556;
      --rail-icon: #AAB7C8;
      --amber: #F59E0B;
      --bg: #F6F7F9;
      --card: #fff;
      --border: #DEE3EA;
      --row-border: #EDF0F4;
      --text: #0F1B2D;
      --muted: #5B6678;
      --muted-2: #7B8698;
      --accent: #2457D6;
      --accent-soft: #E3EBFB;
      --green: #0E7C66;
      --err: #B42318;
      --header-row-bg: #FAFBFC;
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      margin: 0;
      padding: 0;
      height: 100%;
      background: var(--bg);
    }

    body {
      font-family: 'IBM Plex Sans', sans-serif;
      color: var(--text);
      -webkit-font-smoothing: antialiased;
    }

    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }

    ::-webkit-scrollbar-thumb {
      background: #3A3E48;
      border-radius: 8px;
    }

    ::-webkit-scrollbar-track {
      background: transparent;
    }

    .app {
      display: flex;
      width: 100%;
      height: 100vh;
      height: 100dvh;
      /* mobile: follow the visible area, not the screen behind the address bar */
      overflow: hidden;
    }

    /* ---------- SIDEBAR ---------- */
    .sidebar {
      width: 256px;
      min-width: 256px;
      height: 100%;
      background: var(--sidebar-bg);
      border-right: 1px solid var(--sidebar-border);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      overflow: hidden;
    }

    .sidebar-top {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 20px 20px 16px 20px;
    }

    .brand-mark {
      width: 30px;
      height: 30px;
      border-radius: 8px;
      background: var(--accent);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 800;
      font-size: 15px;
    }

    .brand-name {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 700;
      font-size: 16px;
      letter-spacing: -0.01em;
      color: #fff;
    }

    /* ---------- ICON RAIL (desktop) ---------- */
    .rail {
      width: 56px;
      min-width: 56px;
      height: 100%;
      background: var(--rail-bg);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 14px 0 14px 0;
      gap: 10px;
    }

    .rail-logo {
      flex: none;
      background: var(--amber);
    }

    .rail-icons {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      margin-top: 12px;
    }

    .rail-btn {
      width: 40px;
      height: 40px;
      border: 0;
      border-radius: 10px;
      background: transparent;
      color: var(--rail-icon);
      display: grid;
      place-items: center;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }

    .rail-btn:hover {
      background: #10294A;
      color: #fff;
    }

    .rail-btn.active {
      background: var(--rail-active);
      color: #fff;
    }

    .rail-bottom {
      margin-top: auto;
      position: relative;
    }

    .rail-avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      border: 0;
      background: var(--amber);
      color: #0B2239;
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 800;
      font-size: 12px;
      cursor: pointer;
    }

    .rail-pop {
      position: absolute;
      left: 44px;
      bottom: 0;
      width: 250px;
      background: var(--card);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px;
      box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
      z-index: 60;
    }

    .rail-pop[hidden] {
      display: none;
    }

    .rail-pop-name {
      font-size: 13px;
      font-weight: 700;
      word-break: break-word;
    }

    .rail-pop-role {
      font-size: 10.5px;
      font-weight: 700;
      text-transform: uppercase;
      color: var(--muted);
      margin: 3px 0 10px 0;
    }

    .rail-pop-logout {
      width: 100%;
    }

    /* On a desktop the account lives in the rail (avatar at the bottom); the top bar keeps it for phones. */
    @media (min-width: 1025px) {
      #userProfileWidget {
        display: none !important;
      }
    }

    /* ---------- PANEL: title, sections, saved views ---------- */
    .side-head {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 18px 16px 6px 20px;
    }

    .side-title {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 800;
      font-size: 17px;
      color: var(--text);
    }

    .nav-section {
      display: none;
    }

    .nav-section.active {
      display: block;
    }

    .nav-section-title {
      display: none;
    }

    .nav-del {
      font-size: 11px;
      color: var(--muted-2);
      padding: 0 4px;
      border-radius: 4px;
      visibility: hidden;
    }

    .nav-item:hover .nav-del {
      visibility: visible;
    }

    .nav-del:hover {
      color: var(--err);
    }

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

    .nav-add-input {
      width: 100%;
      margin: 4px 0;
      padding: 7px 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font: inherit;
      font-size: 12.5px;
      background: #fff;
    }

    .nav-scroll {
      overflow-y: auto;
      padding: 8px 12px 12px 12px;
      flex: 1;
      min-height: 0;
    }

    .nav-group-label {
      font-size: 10.5px;
      font-weight: 700;
      color: var(--sidebar-group-label);
      text-transform: uppercase;
      letter-spacing: 0.06em;
      padding: 14px 10px 6px 10px;
    }

    .nav-item {
      padding: 9px 10px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      color: var(--sidebar-inactive);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    /* TMS loads in the details panel: one compact line per load that opens to its details */
    .tms-sec .tms-state {
      font-size: 12.5px;
      color: var(--muted);
      padding: 8px 0;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .tms-sec .tms-state-bad {
      color: var(--err);
    }

    .tms-cust {
      border: 1px solid var(--row-border);
      border-radius: 10px;
      padding: 9px 11px;
      margin: 4px 0 10px;
      background: var(--bg);
    }

    .tms-cust-top {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px 8px;
    }

    .tms-cust-name {
      font-weight: 700;
      font-size: 13px;
      color: var(--text);
      word-break: break-word;
    }

    .tms-code {
      font-size: 10.5px;
      font-weight: 700;
      letter-spacing: 0.04em;
      padding: 1px 7px;
      border-radius: 999px;
      background: var(--accent-soft, rgba(36, 87, 214, 0.12));
      color: var(--accent);
    }

    .tms-cust-how {
      font-size: 11.5px;
      color: var(--muted);
      margin-top: 3px;
    }

    .tms-warn {
      margin-top: 7px;
      font-size: 11.5px;
      line-height: 1.35;
      padding: 6px 8px;
      border-radius: 7px;
      background: rgba(217, 119, 6, 0.12);
      color: #b45309;
    }

    .tms-part {
      display: flex;
      align-items: center;
      gap: 6px;
      margin: 12px 0 6px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: var(--muted-2);
    }

    .tms-part span {
      font-size: 10.5px;
      padding: 0 6px;
      border-radius: 999px;
      background: var(--row-border);
      color: var(--muted);
    }

    .tms-load {
      border: 1px solid var(--row-border);
      border-radius: 10px;
      margin-bottom: 7px;
      background: var(--card);
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .tms-load:hover {
      border-color: var(--border);
    }

    .tms-load[open] {
      border-color: var(--border);
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    }

    .tms-load > summary {
      list-style: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 4px 7px;
      padding: 8px 10px 8px 24px;
      position: relative;
      user-select: none;
    }

    .tms-load > summary::-webkit-details-marker {
      display: none;
    }

    .tms-load > summary::before {
      content: '';
      position: absolute;
      left: 9px;
      top: 14px;
      width: 6px;
      height: 6px;
      border-right: 1.6px solid var(--muted);
      border-bottom: 1.6px solid var(--muted);
      transform: rotate(-45deg);
      transition: transform 0.15s ease;
    }

    .tms-load[open] > summary::before {
      transform: rotate(45deg);
      top: 12px;
    }

    .tms-cn {
      font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 12.5px;
      font-weight: 700;
      color: var(--text);
      letter-spacing: 0.01em;
    }

    .tms-size {
      font-size: 11px;
      color: var(--muted);
    }

    .tms-pill {
      margin-left: auto;
      font-size: 9.5px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      padding: 2px 8px;
      border-radius: 999px;
      white-space: nowrap;
    }

    .tms-blue {
      background: rgba(36, 87, 214, 0.12);
      color: #1d4ed8;
    }

    .tms-green {
      background: rgba(22, 163, 74, 0.13);
      color: #15803d;
    }

    .tms-amber {
      background: rgba(217, 119, 6, 0.14);
      color: #b45309;
    }

    .tms-red {
      background: rgba(220, 38, 38, 0.12);
      color: #b91c1c;
    }

    .tms-gray {
      background: var(--row-border);
      color: var(--muted);
    }

    .tms-lfd {
      flex-basis: 100%;
      font-size: 11px;
      color: var(--muted);
    }

    .tms-lfd.tms-warn {
      background: none;
      margin: 0;
      padding: 0;
      font-weight: 600;
      color: #b45309;
    }

    .tms-lfd.tms-bad {
      font-weight: 700;
      color: #b91c1c;
    }

    .tms-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 9px 12px;
      padding: 8px 12px 11px 24px;
      border-top: 1px dashed var(--row-border);
    }

    .tms-f {
      min-width: 0;
    }

    .tms-f span {
      display: block;
      font-size: 9.5px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--muted-2);
      margin-bottom: 1px;
    }

    .tms-f b {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      word-break: break-word;
    }

    .tms-f.tms-warn {
      background: none;
      margin: 0;
      padding: 0;
    }

    .tms-f.tms-warn b {
      color: #b45309;
    }

    .tms-f.tms-bad b {
      color: #b91c1c;
    }

    .tms-none {
      padding: 8px 12px 10px 24px;
      font-size: 12px;
    }

    /* the right (details) panel: drag its left edge to make it wider or narrower (the width is remembered on this computer) */
    .ib.ti,
    .ib.ib-sized {
      position: relative;
    }

    .ti-resize-r {
      display: none;
      position: absolute;
      top: 0;
      bottom: 0;
      right: calc(var(--ti-cw, 300px) - 3px);
      width: 7px;
      cursor: col-resize;
      z-index: 6;
    }

    .ti-resize-r:hover,
    body.ti-dragging .ti-resize-r {
      background: rgba(36, 87, 214, 0.35);
    }

    @media (min-width: 1281px) {
      .ib.ti .ti-resize-r,
      .ib.ib-sized .ti-resize-r {
        display: block;
      }
    }

    .nav-item .nav-lab {
      display: flex;
      align-items: center;
      gap: 9px;
      min-width: 0;
    }

    .nav-item .nav-ico {
      width: 16px;
      height: 16px;
      flex: 0 0 16px;
    }

    .nav-item:hover {
      background: #E8ECF2;
      color: var(--text);
    }

    .nav-item.active {
      background: var(--sidebar-active-bg);
      color: var(--text);
    }

    .nav-item .nav-count {
      font-size: 12px;
      font-weight: 600;
      color: var(--muted);
      min-width: 20px;
      text-align: right;
    }

    /* ---------- MAIN ---------- */
    .main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      height: 100%;
    }

    .topbar {
      height: 64px;
      min-height: 64px;
      border-bottom: 1px solid var(--border);
      background: var(--card);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 32px;
      gap: 12px;
    }

    .topbar-left {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      flex: 1 1 auto;
      overflow: hidden;
    }

    .topbar-title-block {
      min-width: 0;
      flex: 1 1 auto;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .topbar-title {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 700;
      font-size: 18px;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.25;
    }

    .topbar-sub {
      font-size: 12.5px;
      color: var(--muted-2);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.2;
    }

    .topbar-right {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
    }

    .sidebar-toggle-btn {
      display: none;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--card);
      color: var(--text);
      cursor: pointer;
      padding: 0;
      flex-shrink: 0;
      transition: all 0.15s ease;
    }

    .sidebar-toggle-btn:hover {
      background: #F1F5F9;
      color: var(--accent);
      border-color: #CBD5E1;
    }

    .sidebar-close-btn {
      display: none;
      margin-left: auto;
      background: transparent;
      border: none;
      color: var(--sidebar-inactive);
      font-size: 18px;
      padding: 6px 10px;
      cursor: pointer;
      border-radius: 6px;
      line-height: 1;
      transition: all 0.15s ease;
    }

    .sidebar-close-btn:hover {
      background: #E4E7EC;
      color: var(--text);
    }

    .sidebar-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.5);
      backdrop-filter: blur(2px);
      z-index: 998;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;
    }

    .sidebar-backdrop.show {
      opacity: 1;
      pointer-events: auto;
    }

    .btn-log-short {
      display: none;
    }

    .btn-log-full {
      display: inline;
    }

    .user-profile-widget {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: 12px;
      padding-left: 12px;
      border-left: 1px solid var(--border);
      flex-shrink: 0;
    }

    .user-profile-info {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      min-width: 0;
    }

    .pill {
      font-size: 11.5px;
      font-weight: 600;
      padding: 5px 12px;
      border-radius: 20px;
      background: var(--accent-soft);
      color: var(--accent);
      white-space: nowrap;
      flex-shrink: 0;
    }

    /* A page with nothing to say leaves the pill empty: hide it rather than show a blank bubble */
    #recordPill:empty {
      display: none;
    }

    body.view-conversations #recordPill {
      display: none !important;
    }

    .content {
      flex: 1;
      overflow-y: auto;
      padding: 32px;
    }

    .content-header {
      margin-bottom: 20px;
    }

    .content-title {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 700;
      font-size: 24px;
    }

    .content-sub {
      font-size: 14px;
      color: var(--muted);
      margin-top: 4px;
    }

    .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow-x: auto;
      overflow-y: hidden;
    }

    /* The table scrolls sideways inside this box, so the scrollbar sits above the Previous / Next bar. */
    .table-scroll {
      overflow-x: auto;
    }

    table.data {
      width: 100%;
      min-width: max-content;
      border-collapse: collapse;
    }

    table.data th {
      text-align: left;
      padding: 12px 20px;
      background: var(--header-row-bg);
      border-bottom: 1px solid var(--border);
      font-size: 11.5px;
      font-weight: 700;
      color: var(--muted-2);
      text-transform: uppercase;
      letter-spacing: 0.03em;
      white-space: nowrap;
    }

    table.data td {
      text-align: left;
      padding: 14px 20px;
      border-bottom: 1px solid var(--row-border);
      font-size: 13px;
      color: #4B4F58;
      vertical-align: middle;
      white-space: nowrap;
    }

    table.data tr:last-child td {
      border-bottom: none;
    }

    table.data tr:hover td {
      background: #FAFBFC;
    }

    table.data td:first-child {
      font-size: 13.5px;
      font-weight: 600;
      color: var(--text);
    }

    .badge {
      display: inline-block;
      padding: 4px 10px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 600;
      background: #F0F1F4;
      color: var(--muted);
      white-space: nowrap;
    }

    .badge+.badge {
      margin-left: 4px;
    }

    .linked {
      color: var(--muted-2);
      font-size: 13px;
    }

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

    .num-neg {
      color: var(--err);
      font-weight: 600;
    }

    .empty,
    .loading {
      padding: 48px 24px;
      text-align: center;
      color: var(--muted-2);
      font-size: 13.5px;
    }

    .loader-spinner {
      display: inline-block;
      width: 28px;
      height: 28px;
      border: 3px solid rgba(26, 115, 232, 0.15);
      border-radius: 50%;
      border-top-color: var(--accent);
      animation: spin 0.8s ease-in-out infinite;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .err-box {
      padding: 24px;
      text-align: center;
      color: var(--err);
      font-size: 13.5px;
      background: #FEF1F1;
    }

    .table-note {
      padding: 10px 20px;
      font-size: 12px;
      color: var(--muted-2);
      border-top: 1px solid var(--row-border);
      background: var(--header-row-bg);
    }

    /* ---------- OVERVIEW ---------- */
    .kpi-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
      gap: 16px;
      margin-bottom: 28px;
    }

    .kpi {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 18px 20px;
    }

    .kpi-label {
      font-size: 12px;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }

    .kpi-value {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 800;
      font-size: 30px;
      margin-top: 8px;
      color: var(--text);
      line-height: 1;
    }

    .kpi-sub {
      font-size: 12.5px;
      color: var(--muted-2);
      margin-top: 8px;
    }

    /* Overview tiles that open a filtered list (Open pipeline, Open opportunities) */
    .kpi-link {
      cursor: pointer;
      transition: border-color 0.15s, box-shadow 0.15s;
    }

    .kpi-link:hover,
    .kpi-link:focus-visible {
      border-color: var(--accent, #2563eb);
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
      outline: none;
    }

    /* A link inside a tile's sub-line ("6 past 24h SLA", "oldest 866d") */
    .kpi-sublink {
      cursor: pointer;
      text-decoration: underline dotted;
      text-underline-offset: 2px;
    }

    .kpi-sublink:hover,
    .kpi-sublink:focus-visible {
      text-decoration: underline;
      outline: none;
    }

    /* Panel header / badge / "View all" that open the full list */
    .lc-link {
      cursor: pointer;
    }

    .lc-title.lc-link:hover,
    .lc-title.lc-link:focus-visible {
      text-decoration: underline;
      outline: none;
    }

    .count-pill.lc-link:hover {
      background: #D3EEEA;
    }

    .list-card-foot {
      padding: 10px 18px;
      border-top: 1px solid var(--row-border);
      font-size: 12.5px;
      font-weight: 600;
      color: var(--accent);
    }

    .list-card-foot .lc-link:hover,
    .list-card-foot .lc-link:focus-visible {
      text-decoration: underline;
      outline: none;
    }

    /* Filter chips shown next to the View dropdown (e.g. Open, Age > 24h) */
    .view-chip {
      font-size: 12px;
      font-weight: 600;
      color: var(--accent);
      background: var(--accent-soft);
      border-radius: 20px;
      padding: 4px 10px;
      white-space: nowrap;
    }

    .kpi-more {
      font-size: 11.5px;
      font-weight: 600;
      color: var(--accent, #2563eb);
      margin-top: 8px;
    }

    .kpi-sub .hot {
      color: var(--err);
      font-weight: 700;
    }

    .kpi.accent .kpi-value {
      color: var(--green);
    }

    .section-title {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 700;
      font-size: 15px;
      margin: 4px 0 14px 0;
      color: var(--text);
    }

    .notice {
      background: #FFF6DC;
      border: 1px solid #F0D48A;
      color: #6B4300;
      border-radius: 12px;
      padding: 12px 16px;
      margin-bottom: 20px;
      font-size: 13px;
      line-height: 1.5;
    }

    .notice strong {
      font-weight: 700;
      color: #4A2E00;
    }

    .toolbar {
      display: flex;
      gap: 10px;
      align-items: center;
      margin-bottom: 16px;
    }

    .toolbar input[type="search"] {
      flex: 0 1 340px;
      font-family: 'IBM Plex Sans', sans-serif;
      font-size: 13.5px;
      padding: 9px 12px;
      border: 1px solid var(--border);
      border-radius: 9px;
      background: var(--card);
      color: var(--text);
    }

    .toolbar input[type="search"]:focus {
      outline: none;
      border-color: var(--accent);
    }

    /* The View dropdown on the Opportunities and Rate Requests pages: same look as the search box (white, thin border) */
    .toolbar .table-view-select {
      font-family: 'IBM Plex Sans', sans-serif;
      font-size: 13.5px;
      font-weight: 400;
      padding: 9px 12px;
      border: 1px solid var(--border);
      border-radius: 9px;
      background-color: var(--card);
      color: var(--text);
      cursor: pointer;
      box-sizing: border-box;
      height: 38px;   /* same height as the search box */
    }

    .toolbar .table-view-select:focus {
      outline: none;
      border-color: var(--accent);
    }

    .btn-link {
      background: none;
      border: none;
      padding: 0;
      cursor: pointer;
      font-family: 'IBM Plex Sans', sans-serif;
      font-size: 12.5px;
      font-weight: 600;
      color: var(--accent);
    }

    .btn-link:hover {
      text-decoration: underline;
    }

    table.data td.row-actions {
      text-align: right;
      white-space: nowrap;
    }

    .table-note .btn {
      padding: 6px 12px;
      font-size: 12.5px;
    }

    .detail-list {
      display: flex;
      flex-direction: column;
    }

    .detail-row {
      padding: 10px 0;
      border-bottom: 1px solid var(--row-border);
    }

    .detail-row:last-child {
      border-bottom: none;
    }

    .detail-label {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--muted-2);
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }

    .detail-value {
      font-size: 13.5px;
      color: var(--text);
      margin-top: 4px;
      word-break: break-word;
      white-space: pre-wrap;
    }

    .attention-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
      gap: 20px;
    }

    .list-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow: hidden;
    }

    .list-card-head {
      padding: 14px 18px;
      border-bottom: 1px solid var(--row-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 700;
      font-size: 13.5px;
    }

    .list-card-head .count-pill {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--accent);
      background: var(--accent-soft);
      border-radius: 20px;
      padding: 3px 10px;
    }

    .list-row {
      padding: 12px 18px;
      border-bottom: 1px solid var(--row-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .list-row:last-child {
      border-bottom: none;
    }

    .list-row .lr-main {
      min-width: 0;
    }

    .list-row .lr-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .list-row .lr-meta {
      font-size: 12px;
      color: var(--muted-2);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .list-empty {
      padding: 20px 18px;
      color: var(--muted-2);
      font-size: 13px;
    }

    /* ---------- OVERVIEW LAYOUT: main column (Inbox / Sales / Operations) + "Needs attention" side panel ---------- */
    .ov-layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 24px;
      align-items: start;
    }

    .ov-layout.ov-no-side {
      grid-template-columns: minmax(0, 1fr);
    }

    .ov-main {
      min-width: 0;
    }

    .ov-section {
      margin-bottom: 26px;
    }

    .ov-section-label {
      font-size: 11.5px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--muted-2);
      margin: 0 0 10px 2px;
    }

    .ov-grid {
      grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
      gap: 14px;
      margin-bottom: 0;
    }

    .ov-side {
      background: var(--card);
      border-left: 1px solid var(--border);
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      width: 340px;
      overflow-y: auto;
      z-index: 5;
    }

    body.has-ov-side .main {
      padding-right: 340px;
    }

    .ov-side-head {
      padding: 20px 18px 10px;
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 700;
      font-size: 14px;
    }

    .ov-tabs {
      display: flex;
      gap: 4px;
      padding: 0 12px;
      border-bottom: 1px solid var(--row-border);
      overflow-x: auto;
    }

    .ov-tab {
      border: 0;
      background: none;
      padding: 9px 8px;
      font: inherit;
      font-size: 12.5px;
      font-weight: 500;
      color: var(--muted);
      cursor: pointer;
      border-bottom: 2px solid transparent;
      white-space: nowrap;
    }

    .ov-tab.active {
      color: var(--text);
      font-weight: 700;
      border-bottom-color: var(--text);
    }

    .ov-tab-count {
      font-size: 11px;
      font-weight: 700;
      color: var(--muted-2);
      margin-left: 3px;
    }

    .ov-tab.active .ov-tab-count {
      color: var(--text);
    }

    .ov-pane[hidden] {
      display: none;
    }

    .ov-side .list-row {
      justify-content: flex-start;
      gap: 10px;
    }

    .ov-side .list-row .lr-main {
      flex: 1;
    }

    .ov-side-foot {
      padding: 12px 18px;
      border-top: 1px solid var(--row-border);
      font-size: 12.5px;
    }

    .ov-side-foot:empty {
      display: none;
    }

    .ov-side-foot .lc-link {
      color: var(--accent);
      font-weight: 600;
      cursor: pointer;
    }

    .ov-chip {
      flex: none;
      font-size: 10.5px;
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 6px;
      background: #EEF0F4;
      color: #475066;
    }

    .ov-chip-sms {
      background: #DCF3E3;
      color: #1E6B3A;
    }

    .ov-chip-email {
      background: #E0EAFB;
      color: #2554C7;
    }

    .ov-chip-teams {
      background: #E7E4FB;
      color: #4B3FB8;
    }

    @media (max-width: 1180px) {
      .ov-layout {
        grid-template-columns: minmax(0, 1fr);
      }

      .ov-side {
        position: static;
        width: auto;
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
      }

      body.has-ov-side .main {
        padding-right: 0;
      }
    }

    /* ---------- WRITE UI: buttons, drawer, modal, toast ---------- */
    .btn {
      font-family: 'IBM Plex Sans', sans-serif;
      font-size: 13px;
      font-weight: 600;
      padding: 8px 14px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--card);
      color: var(--text);
      cursor: pointer;
      white-space: nowrap;
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      line-height: 1.3;
    }

    .btn:hover {
      background: #F0F1F4;
    }

    .btn-primary {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }

    .btn-primary:hover {
      background: #0B7D73;
    }

    .btn-primary:disabled {
      opacity: 0.5;
      cursor: default;
    }

    /* The Clear button next to a table search box: reddish, so it reads as "remove the filter" */
    #clearSearch {
      color: var(--err);
      background: #FEF2F2;
      border-color: #FCA5A5;
      font-weight: 600;
    }

    #clearSearch:hover {
      background: #FEE2E2;
      border-color: var(--err);
    }

    .btn-ghost {
      background: transparent;
      border-color: transparent;
      color: var(--muted);
    }

    table.data tr.editable {
      cursor: pointer;
    }

    table.data tr.editable:hover td {
      background: #F1FBFA;
    }

    .list-row.editable {
      cursor: pointer;
    }

    .list-row.editable:hover {
      background: #F1FBFA;
    }

    .scrim {
      position: fixed;
      inset: 0;
      background: rgba(20, 23, 31, 0.38);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.15s ease;
      z-index: 40;
    }

    .scrim.show {
      opacity: 1;
      pointer-events: auto;
    }

    .drawer {
      position: fixed;
      top: 0;
      right: 0;
      height: 100vh;
      height: 100dvh;
      /* keeps the Cancel / Save footer on screen on phones */
      max-height: 100dvh;
      width: 400px;
      max-width: 92vw;
      background: var(--card);
      box-shadow: -8px 0 30px rgba(20, 23, 31, 0.15);
      transform: translateX(100%);
      transition: transform 0.18s ease;
      z-index: 50;
      display: flex;
      flex-direction: column;
    }

    .drawer.show {
      transform: translateX(0);
    }

    .drawer-head {
      flex-shrink: 0;
      padding: 20px 24px;
      border-bottom: 1px solid var(--border);
    }

    .drawer-eyebrow {
      font-size: 11.5px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--muted-2);
    }

    .drawer-title {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 700;
      font-size: 17px;
      margin-top: 4px;
    }

    .drawer-body {
      padding: 20px 24px;
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      min-height: 0;
      flex: 1;
    }

    .drawer-foot {
      flex-shrink: 0;
      /* never squeezed out by a tall form */
      padding: 16px 24px;
      border-top: 1px solid var(--border);
      background: var(--card);
      display: flex;
      gap: 10px;
      justify-content: flex-end;
    }

    .field {
      margin-bottom: 16px;
    }

    .field label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: var(--muted);
      margin-bottom: 6px;
    }

    .field select,
    .field input,
    .field textarea {
      width: 100%;
      min-width: 0;
      max-width: 100%;
      box-sizing: border-box;
      font-family: 'IBM Plex Sans', sans-serif;
      font-size: 13.5px;
      padding: 9px 11px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #fff;
      color: var(--text);
    }

    .field select {
      text-overflow: ellipsis;
    }

    .field textarea {
      min-height: 84px;
      resize: vertical;
    }

    .field .checkbox-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .field .checkbox-row input {
      width: auto;
    }

    .drawer-msg {
      font-size: 12.5px;
      margin-top: 4px;
      min-height: 16px;
    }

    .drawer-msg.err {
      color: var(--err);
    }

    .drawer-msg.ok {
      color: #16A34A;
    }

    .drawer-note {
      font-size: 12px;
      color: var(--muted-2);
      margin-top: -6px;
      margin-bottom: 14px;
    }

    .typeahead {
      position: relative;
    }

    .typeahead-results {
      border: 1px solid var(--border);
      border-radius: 8px;
      margin-top: 6px;
      max-height: 180px;
      overflow-y: auto;
      display: none;
    }

    .typeahead-results.show {
      display: block;
    }

    .typeahead-opt {
      padding: 8px 11px;
      font-size: 13px;
      cursor: pointer;
    }

    @keyframes spin {
      0% {
        transform: rotate(0deg);
      }

      100% {
        transform: rotate(360deg);
      }
    }

    .spinner-sm {
      display: inline-block;
      width: 14px;
      height: 14px;
      border: 2px solid #cbd5e1;
      border-top-color: #0284c7;
      border-radius: 50%;
      animation: spin 0.6s linear infinite;
    }

    .typeahead-chosen {
      font-size: 12.5px;
      color: var(--accent);
      font-weight: 600;
      margin-top: 6px;
    }

    .toast {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      background: #14161C;
      color: #fff;
      font-size: 13px;
      font-weight: 500;
      padding: 11px 18px;
      border-radius: 10px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
      opacity: 0;
      pointer-events: none;
      transition: all 0.2s ease;
      /* Must outrank every modal (.email-modal is 100, one variant is 110) —
         a toast fired while a modal is open (which is every send/reply, since
         they're all triggered from inside one) was rendering behind the
         backdrop and was never visible. */
      z-index: 300;
      max-width: 80vw;
    }

    .toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    .toast.err {
      background: #B91C1C;
    }

    .toast.ok {
      background: #0D9488;
    }

    /* ---------- UNIPILE EMAIL INBOX ---------- */
    .unipile-header-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 14px;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px 20px;
    }

    .unipile-acct-select-wrap {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px 18px;
      min-width: 0;
    }

    .unipile-field {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }

    .unipile-field .unipile-select {
      min-width: 0;
      max-width: 100%;
    }

    .unipile-acct-actions {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
    }

    .unipile-acct-label {
      font-size: 12px;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.04em;
      white-space: nowrap;
    }

    .unipile-select {
      font-family: 'IBM Plex Sans', sans-serif;
      font-size: 13px;
      font-weight: 600;
      padding: 7px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #fff;
      color: var(--text);
    }

    .unipile-toolbar-right {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
    }

    .email-unread-dot {
      display: inline-block;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #0284C7;
      margin-right: 6px;
      vertical-align: middle;
    }

    /* Every cell in table.data is nowrap, and a table cell's max-width does not clip what is inside it,
       so long senders and subjects used to spill over into the next column. Clip them with an ellipsis
       (the full text is in the title tooltip) and keep the column widths steady. */
    .email-subject-line {
      font-weight: 600;
      color: var(--text);
      font-size: 13.5px;
      line-height: 1.35;
      margin-bottom: 3px;
      max-width: var(--email-subject-w, clamp(220px, calc(100vw - 1080px), 560px));
      /* 1080px = sidebar + page padding + the other columns */
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .email-snippet-line {
      font-size: 12px;
      line-height: 1.35;
      color: var(--muted-2);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: var(--email-subject-w, clamp(220px, calc(100vw - 1080px), 560px));
      /* 1080px = sidebar + page padding + the other columns */
    }

    .email-sender-name {
      font-weight: 600;
      color: var(--text);
      font-size: 13px;
      line-height: 1.35;
      max-width: 220px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .email-sender-email {
      font-size: 11.5px;
      line-height: 1.35;
      margin-top: 2px;
      color: var(--muted-2);
      max-width: 220px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    /* A little more room between the Sender and Subject columns */
    table.data td.email-col-sender {
      padding-right: 28px;
    }

    .email-tag {
      display: inline-block;
      font-size: 11px;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 12px;
      background: #EEF2F6;
      color: #4B5563;
      margin-right: 4px;
    }

    .email-tag.unread {
      background: #E0F2FE;
      color: #0369A1;
    }

    .email-tag.inbox {
      background: #DCFCE7;
      color: #15803D;
    }

    .pagination-container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 20px;
      border-top: 1px solid var(--row-border);
      background: var(--header-row-bg);
    }

    .pagination-info {
      font-size: 13px;
      color: var(--muted);
      font-weight: 500;
    }

    .pagination-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .email-modal {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.65);
      backdrop-filter: blur(4px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 100;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.18s ease;
    }

    .email-modal.show {
      display: flex;
      opacity: 1;
      pointer-events: auto;
    }

    .login-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      z-index: 999999;
      background: #0B0F19;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      font-family: 'Plus Jakarta Sans', sans-serif;
    }

    .login-overlay.show {
      display: flex !important;
    }

    .user-row-hover:hover {
      background: #F8FAFC !important;
    }

    .email-modal-card {
      background: #fff;
      border-radius: 16px;
      width: 880px;
      max-width: 95vw;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
      overflow: hidden;
    }

    .email-modal-header {
      flex-shrink: 0;
      padding: 20px 24px;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      background: #FAFBFC;
    }

    .email-modal-meta {
      font-size: 12.5px;
      color: var(--muted-2);
      margin-top: 6px;
      line-height: 1.6;
    }

    .email-modal-body {
      padding: 20px 24px;
      overflow-y: auto;
      flex: 1;
      display: block;
      line-height: 1.6;
      font-size: 13.5px;
      background: #fff;
      min-height: 150px;
    }

    .email-modal-footer {
      flex-shrink: 0;
      padding: 14px 24px;
      border-top: 1px solid var(--border);
      display: flex;
      justify-content: flex-end;
      background: #FAFBFC;
    }

    /* The reply form of the Unipile and the Shared Mailbox email popups. It sits between the email body and the card's bottom edge
       inside a card that is clipped (overflow: hidden) and has a fixed height. A flex item will not shrink below its content
       and this section had no overflow of its own, so on a short screen the form was simply cut off (Send Reply unreachable).
       Now it may shrink (min-height: 0), takes at most 65% of the card and always leaves room for the header and a little of the
       email, and scrolls inside itself, the same way the Notes section already does. */
    #emailReplySection,
    #graphMailReplySection {
      flex: 0 1 auto;
      min-height: 0;
      max-height: max(120px, min(65%, calc(100% - 190px)));
      overflow-y: auto;
      overscroll-behavior: contain;
    }

    /* The email body may shrink to this while a reply form is open (the shared .email-modal-body minimum is 150px). */
    #emailModalBody,
    #graphMailModalBody {
      min-height: 96px;
    }

    /* A phone held sideways (or any very short window): the popup header is a large share of the height, so the email body
       may shrink further to leave the reply form room. */
    @media (max-height: 480px) {
      #emailModalBody,
      #graphMailModalBody {
        min-height: 40px;
      }
    }

    .email-frame {
      width: 100%;
      height: 100%;
      flex: 1;
      min-height: 150px;
      border: none;
      border-radius: 8px;
      background: #fff;
    }

    .loader-spinner {
      display: inline-block;
      width: 28px;
      height: 28px;
      border: 3px solid #E2E8F0;
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.75s linear infinite;
      vertical-align: middle;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .thread-msg-card {
      position: relative;
    }

    .thread-msg-card .msg-fullview-btn {
      position: absolute;
      top: 14px;
      right: 18px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s ease;
      transform: translateY(-5px);
      z-index: 10;
      padding: 4px 8px;
      font-size: 11.5px;
      font-weight: 600;
      color: var(--accent);
      background: var(--accent-soft);
      border: 1px solid #CFF2EF;
      border-radius: 6px;
      cursor: pointer;
    }

    .thread-msg-card:hover .msg-fullview-btn {
      opacity: 1;
      pointer-events: auto;
      transform: translateY(0);
    }

    /* ---------- TELEGRAM CHAT HISTORY ---------- */
    .tg-msg-bubble {
      max-width: 70%;
      padding: 10px 14px;
      border-radius: 14px;
      font-size: 13px;
      line-height: 1.5;
      word-break: break-word;
      position: relative;
      display: flex;
      flex-direction: column;
    }

    .tg-msg-bubble.inbound {
      align-self: flex-start;
      background: #fff;
      color: var(--text);
      border-top-left-radius: 2px;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    .tg-msg-bubble.outbound {
      align-self: flex-end;
      background: #D9FDD3;
      color: var(--text);
      border-top-right-radius: 2px;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    .tg-msg-header {
      font-size: 11px;
      font-weight: 700;
      color: var(--muted);
      margin-bottom: 4px;
    }

    .tg-msg-text {
      font-family: 'IBM Plex Sans', sans-serif;
      white-space: pre-wrap;
    }

    .tg-msg-text.html-content {
      white-space: normal;
    }

    .tg-msg-text.html-content p {
      margin: 0 0 8px 0;
    }

    .tg-msg-text.html-content p:last-child {
      margin-bottom: 0;
    }

    .tg-msg-text img {
      max-width: 100%;
      height: auto;
      border-radius: 8px;
      margin-top: 6px;
      display: block;
    }

    .tg-msg-time {
      font-size: 10px;
      color: var(--muted-2);
      margin-top: 4px;
      text-align: right;
    }

    .tg-msg-bubble:hover .tg-reply-hover-btn,
    .tg-msg-bubble:hover .teams-reply-hover-btn {
      opacity: 1 !important;
    }

    /* ---------- Chat date partitions (Teams chat modal, SMS conversations, internal Team Chat) ---------- */
    .chat-date-divider {
      align-self: center;
      margin: 12px auto;
      padding: 4px 12px;
      background: #ffffff;
      color: #54656f;
      font-size: 11px;
      font-weight: 600;
      border-radius: 8px;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
      letter-spacing: 0.3px;
      text-transform: uppercase;
      z-index: 1;
    }

    .chat-sticky-date-indicator {
      position: absolute;
      top: 10px;
      left: 50%;
      transform: translateX(-50%);
      margin: 0;
      padding: 4px 12px;
      background: #ffffff;
      color: #54656f;
      font-size: 11px;
      font-weight: 600;
      border-radius: 8px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
      letter-spacing: 0.3px;
      text-transform: uppercase;
      z-index: 10;
      pointer-events: none;
      white-space: nowrap;
      user-select: none;
      transition: opacity 0.15s ease;
    }

    /* ---------- TEAM CHAT STYLES ---------- */
    body.view-team-chat .content {
      padding: 20px 24px !important;
      box-sizing: border-box !important;
      overflow: hidden !important;
      display: flex !important;
      flex-direction: column !important;
      height: calc(100vh - 64px) !important;
      height: calc(100dvh - 64px) !important;
      min-height: 0 !important;
    }

    body.view-team-chat #content {
      flex: 1 1 0% !important;
      height: 100% !important;
      min-height: 0 !important;
      max-height: 100% !important;
      display: flex !important;
      flex-direction: column !important;
      overflow: hidden !important;
    }

    .team-chat-container {
      display: flex !important;
      flex: 1 1 0% !important;
      height: 100% !important;
      min-height: 0 !important;
      max-height: 100% !important;
      background: var(--card) !important;
      border: 1px solid var(--border) !important;
      border-radius: 12px !important;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
      overflow: hidden !important;
      position: relative !important;
    }

    .team-chat-sidebar {
      width: 290px;
      min-width: 280px;
      max-width: 310px;
      background: #F8FAFC;
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      height: 100%;
      overflow: hidden;
    }

    .team-chat-search {
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
    }

    .team-chat-search input {
      width: 100%;
      padding: 7px 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 12.5px;
      outline: none;
      background: #fff;
    }

    .team-chat-list {
      flex: 1;
      overflow-y: auto;
      padding: 10px 8px;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .team-chat-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.15s ease;
      position: relative;
    }

    .team-chat-item:hover {
      background: #EDF2F7;
    }

    .team-chat-item.active {
      background: #E2E8F0;
      font-weight: 600;
    }

    .team-chat-main {
      flex: 1;
      display: flex;
      flex-direction: column;
      background: #ffffff;
      min-width: 0;
      height: 100%;
      overflow: hidden;
    }

    .team-chat-header {
      padding: 10px 16px;
      min-height: 54px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #fff;
      flex-shrink: 0;
    }

    .team-chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 20px 28px 20px 24px !important;
      display: flex;
      flex-direction: column;
      gap: 12px;
      box-sizing: border-box;
    }

    .team-chat-bubble,
    .bubble-text {
      border-radius: 12px;
      padding: 7px 12px;
      font-size: 13px;
      line-height: 1.5;
      word-break: break-word !important;
      white-space: pre-wrap !important;
      text-align: left;
    }

    .team-chat-bubble strong,
    .bubble-text strong {
      font-weight: 700;
    }

    .team-chat-bubble em,
    .bubble-text em {
      font-style: italic;
    }

    .team-chat-bubble code,
    .bubble-text code {
      background: rgba(0, 0, 0, 0.06);
      padding: 2px 5px;
      border-radius: 4px;
      font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
      font-size: 12px;
      color: #9333EA;
    }

    .team-chat-bubble pre,
    .bubble-text pre {
      margin: 4px 0;
      padding: 8px 12px;
      border-radius: 6px;
      font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
      font-size: 12px;
      white-space: pre-wrap !important;
      overflow-x: auto;
      background: #0F172A;
      color: #E2E8F0;
    }

    .team-chat-format-btn {
      padding: 2px 7px;
      font-size: 11.5px;
      cursor: pointer;
      border-radius: 4px;
      border: 1px solid var(--border);
      background: #FFFFFF;
      color: var(--text);
      font-weight: 600;
      transition: all 0.15s ease;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      height: 24px;
      min-width: 24px;
      user-select: none;
    }

    .team-chat-format-btn:hover {
      background: #F1F5F9;
      border-color: #CBD5E1;
      color: var(--accent);
    }

    .team-chat-format-btn.active {
      background: var(--accent) !important;
      border-color: var(--accent) !important;
      color: #FFFFFF !important;
      box-shadow: 0 1px 4px rgba(13, 148, 136, 0.35);
    }

    .team-chat-format-btn.active:hover {
      background: #0f766e !important;
      border-color: #0f766e !important;
      color: #FFFFFF !important;
    }

    .team-chat-format-btn[data-format="bold"] {
      font-weight: 800;
    }

    .team-chat-format-btn[data-format="italic"] {
      font-style: italic;
      font-weight: 700;
      font-family: serif;
    }

    .team-chat-format-btn[data-format="code"] {
      font-family: monospace;
      font-size: 11px;
    }

    .team-chat-msg-row {
      max-width: 78%;
    }

    .team-chat-msg-row.from-me {
      margin-right: 12px !important;
    }

    .team-chat-input-area {
      padding: 14px 20px !important;
      border-top: 1px solid var(--border);
      background: #FAFBFD;
      display: flex;
      flex-direction: column;
      gap: 8px;
      flex-shrink: 0;
      box-sizing: border-box;
    }

    .team-chat-emoji-drawer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 8px;
    }

    .team-chat-composer-pill {
      display: flex;
      align-items: flex-end;
      gap: 8px;
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 6px 8px 6px 14px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .team-chat-composer-pill:focus-within {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
    }

    .team-chat-textarea {
      flex: 1;
      border: none;
      outline: none;
      font-family: inherit;
      font-size: 14px;
      line-height: 1.45;
      min-height: 24px;
      max-height: 90px;
      overflow-y: auto;
      background: transparent;
      padding: 4px 0;
      margin: 0;
      word-break: break-word;
      white-space: pre-wrap;
      color: var(--text);
    }

    .team-chat-textarea:empty:before {
      content: attr(data-placeholder);
      color: var(--muted-2);
      pointer-events: none;
      display: block;
    }

    .team-chat-textarea code {
      background: rgba(0, 0, 0, 0.06);
      padding: 2px 5px;
      border-radius: 4px;
      font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
      font-size: 12.5px;
      color: #9333EA;
    }

    .team-chat-emoji-toggle-btn {
      display: none;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      min-width: 32px;
      border-radius: 50%;
      border: none;
      background: transparent;
      cursor: pointer;
      font-size: 18px;
      margin-bottom: 1px;
      transition: background 0.15s ease;
      user-select: none;
    }

    .team-chat-emoji-toggle-btn:hover {
      background: #F1F5F9;
    }

    .team-chat-send-circle-btn {
      width: 34px;
      height: 34px;
      min-width: 34px;
      border-radius: 50%;
      background: var(--accent);
      color: #fff;
      border: none;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      margin-bottom: 0px;
      transition: transform 0.1s ease, background 0.15s ease;
      box-shadow: 0 2px 6px rgba(13, 148, 136, 0.35);
    }

    .team-chat-send-circle-btn:hover {
      background: #0B7D73;
      transform: scale(1.05);
    }

    .team-chat-send-circle-btn:active {
      transform: scale(0.95);
    }

    .team-chat-back-btn {
      display: none;
      align-items: center;
      justify-content: center;
      width: 34px;
      height: 34px;
      border-radius: 50%;
      border: none;
      background: transparent;
      color: var(--text);
      cursor: pointer;
      flex-shrink: 0;
      padding: 0;
      transition: background 0.15s ease;
    }

    .team-chat-back-btn:hover {
      background: #F1F5F9;
    }

    .team-chat-quick-emoji {
      padding: 2px 6px;
      font-size: 13px;
      cursor: pointer;
      border-radius: 4px;
      border: 1px solid transparent;
      background: none;
      transition: background 0.15s ease;
    }

    .team-chat-quick-emoji:hover {
      background: #EDF2F7;
    }

    .team-chat-presence-dot {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      border: 2px solid #fff;
      position: absolute;
      bottom: -1px;
      right: -1px;
    }

    .team-chat-presence-online {
      background: #10B981;
      box-shadow: 0 0 0 1px #10B981;
    }

    .team-chat-presence-offline {
      background: #CBD5E1;
    }

    /* ==========================================================================
       SMS CONVERSATIONS (QUO / #QUO-MESSAGES) MODERN STYLING
       ========================================================================== */

    body.view-quo-messages .content {
      padding: 20px 24px !important;
      box-sizing: border-box !important;
      overflow: hidden !important;
      height: calc(100vh - 64px) !important;
      height: calc(100dvh - 64px) !important;
      display: flex !important;
      flex-direction: column !important;
      min-height: 0 !important;
    }

    body.view-quo-messages #content {
      flex: 1 1 0% !important;
      height: 100% !important;
      min-height: 0 !important;
      max-height: 100% !important;
      display: flex !important;
      flex-direction: column !important;
      overflow: hidden !important;
    }

    .quo-messages-workspace {
      display: flex !important;
      flex: 1 1 0% !important;
      width: 100% !important;
      height: 100% !important;
      min-height: 0 !important;
      max-height: 100% !important;
      background: #ffffff !important;
      border: 1px solid var(--border) !important;
      border-radius: 12px !important;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
      overflow: hidden !important;
      position: relative !important;
    }

    .quo-sidebar {
      width: 300px !important;
      min-width: 280px !important;
      max-width: 320px !important;
      border-right: 1px solid var(--border) !important;
      display: flex !important;
      flex-direction: column !important;
      background: #f8fafc !important;
      height: 100% !important;
      min-height: 0 !important;
      max-height: 100% !important;
      overflow: hidden !important;
      flex-shrink: 0 !important;
    }

    #quoConversationsList {
      flex: 1 1 0% !important;
      min-height: 0 !important;
      overflow-y: auto !important;
      padding: 8px 10px !important;
      display: flex !important;
      flex-direction: column !important;
      gap: 4px !important;
      box-sizing: border-box !important;
    }

    .quo-chat-area {
      flex: 1 1 0% !important;
      display: flex !important;
      flex-direction: column !important;
      background: #ffffff !important;
      min-width: 0 !important;
      height: 100% !important;
      min-height: 0 !important;
      max-height: 100% !important;
      overflow: hidden !important;
    }

    #quoActiveChatHeader {
      flex-shrink: 0 !important;
    }

    #quoActiveChatPane {
      box-sizing: border-box !important;
      padding: 20px 24px !important;
      background: #f8fafc !important;
      flex: 1 1 0% !important;
      min-height: 0 !important;
      overflow-y: auto !important;
      display: flex !important;
      flex-direction: column !important;
      gap: 12px !important;
    }

    #quoActiveChatFooter {
      flex-shrink: 0 !important;
      background: #ffffff !important;
      border-top: 1px solid var(--border) !important;
      padding: 14px 18px !important;
      box-sizing: border-box !important;
    }

    .quo-msg-row {
      display: flex;
      flex-direction: column;
      max-width: 78%;
      box-sizing: border-box;
    }

    .quo-msg-row.outbound {
      align-self: flex-end;
      align-items: flex-end;
      margin-right: 12px;
    }

    .quo-msg-row.inbound {
      align-self: flex-start;
      align-items: flex-start;
      margin-left: 4px;
    }

    .quo-msg-meta {
      font-size: 11px;
      color: #64748b;
      margin-bottom: 3px;
      line-height: 1.2;
    }

    .quo-msg-row.outbound .quo-msg-meta {
      text-align: right;
      padding-right: 2px;
    }

    .quo-msg-row.inbound .quo-msg-meta {
      text-align: left;
      padding-left: 2px;
    }

    .quo-msg-bubble {
      padding: 10px 14px;
      font-size: 13.5px;
      line-height: 1.45;
      width: fit-content;
      max-width: 100%;
      box-sizing: border-box;
      white-space: pre-wrap !important;
      word-break: break-word !important;
    }

    .quo-msg-row.outbound .quo-msg-bubble {
      background: #007aff;
      color: #ffffff;
      border-radius: 16px 16px 3px 16px;
      box-shadow: 0 1px 3px rgba(0, 122, 255, 0.22);
    }

    .quo-msg-row.inbound .quo-msg-bubble {
      background: #ffffff;
      color: #1e293b;
      border: 1px solid #e2e8f0;
      border-radius: 16px 16px 16px 3px;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    .quo-back-btn {
      display: none;
      align-items: center;
      justify-content: center;
      width: 34px;
      height: 34px;
      border-radius: 50%;
      border: none;
      background: transparent;
      color: var(--text);
      cursor: pointer;
      flex-shrink: 0;
      padding: 0;
      margin-right: 6px;
      transition: background 0.15s ease;
    }

    .quo-back-btn:hover {
      background: #F1F5F9;
    }

    .quo-reply-textarea {
      flex: 1;
      min-height: 38px;
      max-height: 120px;
      padding: 9px 12px;
      border: 1px solid #ccc;
      border-radius: 8px;
      font-size: 13.5px;
      font-family: inherit;
      line-height: 1.4;
      resize: none;
      box-sizing: border-box;
      background: #fff;
      outline: none;
      transition: border-color 0.15s, box-shadow 0.15s;
    }

    .quo-reply-textarea:focus {
      border-color: #007aff;
      box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
    }

    .quo-conv-item {
      padding: 10px 12px !important;
      border-radius: 8px !important;
      border: 1px solid transparent !important;
      transition: all 0.15s ease !important;
      cursor: pointer !important;
      box-sizing: border-box !important;
      background: transparent;
    }

    .quo-conv-item:hover {
      background: #EDF2F7 !important;
      border-color: #E2E8F0 !important;
    }

    .quo-conv-item.active {
      background: #E2E8F0 !important;
      border-color: #CBD5E1 !important;
      font-weight: 600 !important;
    }

    .quo-line-dropdown-wrapper {
      position: relative;
      margin-bottom: 8px;
      width: 100%;
    }

    .quo-line-filter-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      padding: 9px 12px;
      background: #F8FAFC;
      border: 1px solid #E2E8F0;
      border-radius: 9px;
      box-sizing: border-box;
      cursor: pointer;
      font-family: inherit;
      text-align: left;
      transition: all 0.15s ease;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    }

    .quo-line-filter-bar:hover {
      border-color: #CBD5E1;
      background: #F1F5F9;
    }

    .quo-line-filter-bar.open {
      border-color: #007aff;
      background: #ffffff;
      box-shadow: 0 0 0 2.5px rgba(0, 122, 255, 0.15);
    }

    .quo-line-filter-label {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: #64748B;
      flex-shrink: 0;
    }

    .quo-line-filter-val {
      flex: 1;
      min-width: 0;
      font-size: 13px;
      font-weight: 600;
      color: #0F172A;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .quo-line-dropdown-chevron {
      color: #64748B;
      flex-shrink: 0;
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .quo-line-filter-bar.open .quo-line-dropdown-chevron {
      transform: rotate(180deg);
      color: #007aff;
    }

    .quo-line-menu-popover {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      right: 0;
      background: #ffffff;
      border: 1px solid #E2E8F0;
      border-radius: 10px;
      box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.14), 0 6px 12px -2px rgba(15, 23, 42, 0.06);
      z-index: 1050;
      padding: 6px;
      max-height: 270px;
      overflow-y: auto;
      box-sizing: border-box;
    }

    .quo-line-menu-popover.show {
      display: flex;
      flex-direction: column;
      gap: 3px;
      animation: quoMenuFadeIn 0.14s ease-out;
    }

    @keyframes quoMenuFadeIn {
      from {
        opacity: 0;
        transform: translateY(-4px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .quo-line-menu-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 14px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.12s ease;
      background: transparent;
      user-select: none;
    }

    .quo-line-menu-item:hover {
      background: #F1F5F9;
    }

    .quo-line-menu-item.active {
      background: #EFF6FF;
    }

    .quo-line-item-info {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
      flex: 1;
    }

    .quo-line-item-name {
      font-size: 13px;
      font-weight: 600;
      color: #1E293B;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .quo-line-menu-item.active .quo-line-item-name {
      color: #0284C7;
      font-weight: 700;
    }

    .quo-line-item-phone {
      font-size: 11.5px;
      color: #64748B;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .quo-line-menu-item.active .quo-line-item-phone {
      color: #0369A1;
    }

    .quo-line-item-check {
      color: #0284C7;
      flex-shrink: 0;
    }

    #quoSendFromSelect,
    #quoContactSelect {
      padding: 6px 10px !important;
      border: 1px solid #CBD5E1 !important;
      border-radius: 8px !important;
      font-size: 12.5px !important;
      font-weight: 500 !important;
      color: #1E293B !important;
      background-color: #FFFFFF !important;
      outline: none !important;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    #quoSendFromSelect:focus,
    #quoContactSelect:focus {
      border-color: #007aff !important;
      box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15) !important;
    }

    #quoRecipientPhone {
      padding: 6px 10px !important;
      border: 1px solid #CBD5E1 !important;
      border-radius: 8px !important;
      font-size: 12.5px !important;
      outline: none !important;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    #quoRecipientPhone:focus {
      border-color: #007aff !important;
      box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15) !important;
    }

    /* Attachment Manager Component */
    .attachment-component-box {
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #FAFAFA;
      overflow: hidden;
    }

    .attachment-file-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 7px 10px;
      background: #FFFFFF;
      border: 1px solid #E2E8F0;
      border-radius: 6px;
      font-size: 12.5px;
      transition: background 0.15s ease, border-color 0.15s ease;
    }

    .attachment-file-row:hover {
      background: #F8FAFC;
      border-color: #CBD5E1;
    }

    .btn-remove-attachment {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: #FEE2E2;
      border: 1px solid #FECACA;
      color: #DC2626;
      font-size: 11.5px;
      font-weight: 600;
      cursor: pointer;
      padding: 3px 8px;
      border-radius: 4px;
      flex-shrink: 0;
      transition: all 0.15s ease;
    }

    .btn-remove-attachment:hover {
      background: #FCA5A5;
      color: #991B1B;
    }

    /* Multi-Email Chip Tag Component */
    .email-chips-wrap {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 5px;
      padding: 6px 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #FFFFFF;
      min-height: 42px;
      cursor: text;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
      box-sizing: border-box;
      width: 100%;
    }

    .email-chips-wrap:hover {
      border-color: #94A3B8;
    }

    .email-chips-wrap:focus-within {
      border-color: var(--accent, #0D9488);
      box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.18);
    }

    .email-chips-wrap.compact {
      min-height: 32px;
      padding: 3px 6px;
      border-radius: 6px;
      gap: 4px;
    }

    .email-chips-list {
      display: inline-flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 4px;
    }

    .email-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      background: #EEF2FF;
      border: 1px solid #C7D2FE;
      color: #3730A3;
      border-radius: 5px;
      padding: 2px 7px;
      font-size: 11.5px;
      font-weight: 500;
      user-select: none;
      transition: all 0.15s ease;
      max-width: 100%;
      line-height: 1.4;
    }

    .email-chips-wrap.compact .email-chip {
      padding: 1px 5px;
      font-size: 11px;
      border-radius: 4px;
    }

    .email-chip.invalid {
      background: #FEF2F2;
      border-color: #FECACA;
      color: #DC2626;
    }

    .email-chip-text {
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
      max-width: 260px;
    }

    .email-chip-remove {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: none;
      background: transparent;
      color: inherit;
      cursor: pointer;
      font-size: 11px;
      font-weight: 700;
      line-height: 1;
      padding: 0 2px;
      border-radius: 3px;
      opacity: 0.65;
      transition: all 0.15s ease;
    }

    .email-chip-remove:hover {
      opacity: 1;
      background: rgba(0, 0, 0, 0.12);
      color: #B91C1C;
    }

    .email-chips-inner-input {
      flex: 1 1 110px;
      min-width: 110px;
      border: none;
      outline: none;
      padding: 3px 4px;
      font-size: 12.5px;
      background: transparent;
      font-family: inherit;
      color: var(--text, #1E293B);
    }

    .email-chips-wrap.compact .email-chips-inner-input {
      font-size: 11.5px;
      padding: 1px 3px;
      min-width: 90px;
    }

    .email-chips-inner-input::placeholder {
      color: #94A3B8;
      font-style: italic;
      font-size: 11.5px;
    }

    /* ==========================================================================
       COMPREHENSIVE RESPONSIVE LAYOUT & HEADER SYSTEM (320px to 4K)
       ========================================================================== */

    @media (max-width: 1024px) {
      .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
      }

      .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 32px rgba(0, 0, 0, 0.4);
      }

      .sidebar-toggle-btn {
        display: inline-flex;
      }

      .sidebar-close-btn {
        display: inline-flex;
      }

      .rail {
        display: none;
      }

      .side-title {
        display: none;
      }

      .side-head {
        padding: 12px 8px 0 16px;
      }

      .nav-section {
        display: block;
      }

      .nav-section-title {
        cursor: pointer;
        display: block;
        font-family: 'Plus Jakarta Sans', sans-serif;
        font-weight: 800;
        font-size: 14px;
        color: var(--text);
        padding: 14px 10px 2px 10px;
      }

      .nav-del {
        visibility: visible;
      }

      .topbar {
        padding: 0 16px;
      }

      .content {
        padding: 20px 16px;
      }
    }

    /* Tablet (601px - 1024px) - WhatsApp Web Side-by-Side Experience */
    @media (min-width: 601px) and (max-width: 1024px) {
      body.view-team-chat .content {
        padding: 16px !important;
        box-sizing: border-box !important;
        height: calc(100vh - 64px) !important;
        height: calc(100dvh - 64px) !important;
      }

      .team-chat-container {
        display: flex !important;
        flex-direction: row !important;
        height: 100% !important;
        width: 100% !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
      }

      .team-chat-sidebar {
        width: 290px !important;
        min-width: 280px !important;
        max-width: 310px !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        position: static !important;
        border-right: 1px solid var(--border) !important;
      }

      .team-chat-main {
        flex: 1 !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        position: static !important;
        transform: none !important;
      }

      .team-chat-back-btn {
        display: none !important;
      }

      body.view-quo-messages .content {
        padding: 16px !important;
        box-sizing: border-box !important;
        height: calc(100vh - 64px) !important;
        height: calc(100dvh - 64px) !important;
      }

      .quo-messages-workspace {
        display: flex !important;
        flex-direction: row !important;
        height: 100% !important;
        width: 100% !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
      }

      .quo-sidebar {
        width: 290px !important;
        min-width: 280px !important;
        max-width: 310px !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        position: static !important;
        border-right: 1px solid var(--border) !important;
      }

      .quo-chat-area {
        flex: 1 !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        position: static !important;
        transform: none !important;
      }

      .quo-back-btn {
        display: none !important;
      }
    }

    @media (max-width: 768px) {
      .topbar-sub {
        display: none !important;
      }

      .topbar-title {
        font-size: 16.5px;
      }

      #userRoleBadge {
        display: none !important;
      }

      #userDisplayName {
        max-width: 85px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11.5px !important;
      }

      .kpi-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
        margin-bottom: 20px;
      }

      .attention-grid {
        grid-template-columns: 1fr;
        gap: 14px;
      }

      .toolbar {
        flex-wrap: wrap;
        gap: 8px;
      }

      .toolbar input[type="search"] {
        flex: 1 1 100%;
        max-width: 100%;
      }
    }

    /* Mobile (<=600px down to 320px) - WhatsApp Native Experience */
    @media (max-width: 600px) {
      .topbar {
        height: 54px !important;
        min-height: 54px !important;
        padding: 0 10px !important;
        gap: 8px !important;
      }

      .topbar-left {
        gap: 8px;
      }

      .topbar-right {
        gap: 8px;
      }

      body.mobile-chat-active .topbar {
        display: none !important;
      }

      body.view-team-chat .content {
        padding: 0 !important;
        height: calc(100vh - 54px);
        height: calc(100dvh - 54px);
      }

      body.view-team-chat.mobile-chat-active .content {
        height: 100vh !important;
        height: 100dvh !important;
      }

      body.mobile-chat-active .app {
        height: 100vh !important;
        height: 100dvh !important;
      }

      #recordPill {
        display: none !important;
      }

      .btn-log-full {
        display: none !important;
      }

      .btn-log-short {
        display: inline !important;
      }

      #logActivityBtn {
        padding: 6px 10px;
        font-size: 12px;
      }

      #userRoleBadge {
        display: none !important;
      }

      #userDisplayName {
        max-width: 65px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px !important;
      }

      .user-profile-widget {
        gap: 6px;
        margin-left: 6px;
        padding-left: 6px;
      }

      #logoutBtn {
        font-size: 11.5px;
        padding: 4px 7px;
      }

      .content {
        padding: 16px 12px;
      }

      .content-title {
        font-size: 20px;
      }

      .content-sub {
        font-size: 13px;
      }

      .card {
        border-radius: 10px;
      }

      .unipile-header-bar {
        padding: 10px 12px;
        gap: 10px;
      }

      .unipile-acct-select-wrap {
        flex: 1 1 100%;
        gap: 10px;
      }

      /* Phones: label above a full-width select, one field per row */
      .unipile-field {
        flex: 1 1 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
      }

      .unipile-field .unipile-select {
        width: 100%;
      }

      .unipile-acct-actions {
        flex: 1 1 100%;
      }

      .unipile-acct-actions .btn {
        margin-left: auto;
      }

      .unipile-toolbar-right {
        flex: 1 1 100%;
        flex-wrap: nowrap;
      }

      .unipile-toolbar-right .unipile-select {
        flex: 1 1 auto;
        min-width: 0;
      }

      .email-modal {
        padding: 0;
      }

      .email-modal-card {
        width: 100vw !important;
        max-width: 100vw !important;
        /* % of the fixed full-screen .email-modal = exactly the visible area, with or without the
           browser address bar. vh/dvh made the card taller than that and, being centred, pushed the
           close icon and the footer buttons off BOTH ends. */
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
      }

      .email-modal-header {
        padding: 14px 16px;
      }

      .email-modal-body {
        padding: 14px 16px;
      }

      .email-modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
      }

      /* Single-Screen WhatsApp Style Mobile Team Chat */
      .team-chat-container {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        border: none !important;
        border-radius: 0 !important;
        display: block !important;
      }

      /* Screen 1: Channels & DMs List */
      .team-chat-sidebar {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        border-right: none !important;
        z-index: 1 !important;
        display: flex !important;
      }

      /* Screen 2: Active Conversation */
      .team-chat-main {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: #ffffff !important;
        z-index: 1000 !important;
        transform: translateX(100%) !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
        will-change: transform !important;
      }

      body.mobile-chat-active .team-chat-main,
      .team-chat-container.mobile-chat-active .team-chat-main {
        transform: translateX(0) !important;
      }

      .team-chat-back-btn {
        display: inline-flex !important;
      }

      .team-chat-header {
        min-height: 52px !important;
        padding: 6px 10px !important;
        border-bottom: 1px solid var(--border) !important;
        background: #fff !important;
      }

      .team-chat-messages {
        padding: 12px 10px !important;
      }

      .team-chat-msg-row {
        max-width: 88% !important;
      }

      .team-chat-input-area {
        position: sticky !important;
        bottom: 0 !important;
        padding: 8px 10px !important;
        padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
        background: #F8FAFC !important;
        border-top: 1px solid var(--border) !important;
        z-index: 10 !important;
      }

      .team-chat-textarea {
        font-size: 16px !important;
        /* Prevents iOS auto-zoom on focus */
        max-height: 90px !important;
      }

      .team-chat-emoji-drawer {
        display: none !important;
        padding-bottom: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--border);
      }

      .team-chat-emoji-drawer.open {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
      }

      .team-chat-hint-text {
        display: none !important;
      }

      .team-chat-emoji-toggle-btn {
        display: inline-flex !important;
      }

      .team-chat-composer-pill {
        padding: 4px 6px 4px 6px !important;
      }

      /* Single-Screen WhatsApp Style Mobile Quo SMS */
      body.view-quo-messages .content {
        padding: 0 !important;
        height: calc(100vh - 54px) !important;
        height: calc(100dvh - 54px) !important;
      }

      body.view-quo-messages #content {
        height: 100% !important;
        min-height: 0 !important;
        flex: 1 1 0% !important;
        display: flex !important;
        flex-direction: column !important;
      }

      body.mobile-quo-chat-active .topbar {
        display: none !important;
      }

      body.mobile-quo-chat-active .content {
        padding: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
      }

      body.mobile-quo-chat-active #content {
        height: 100vh !important;
        height: 100dvh !important;
      }

      .quo-messages-workspace {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        border: none !important;
        border-radius: 0 !important;
        display: block !important;
      }

      /* Screen 1: Conversations List */
      .quo-sidebar {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        border-right: none !important;
        z-index: 1 !important;
        display: flex !important;
      }

      /* Screen 2: Active Chat Area */
      .quo-chat-area {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: #ffffff !important;
        z-index: 1000 !important;
        transform: translateX(100%) !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
        will-change: transform !important;
      }

      body.mobile-quo-chat-active .quo-chat-area,
      .quo-messages-workspace.mobile-quo-chat-active .quo-chat-area {
        transform: translateX(0) !important;
      }

      .quo-back-btn {
        display: inline-flex !important;
      }

      #quoActiveChatPane {
        padding: 14px 12px !important;
      }

      .quo-msg-row {
        max-width: 88% !important;
      }

      .quo-msg-row.outbound {
        margin-right: 8px !important;
      }

      .quo-msg-row.inbound {
        margin-left: 2px !important;
      }

      .quo-reply-textarea {
        font-size: 16px !important;
        /* Prevents iOS Safari auto-zoom on focus */
      }

      #quoActiveChatFooter {
        position: sticky !important;
        bottom: 0 !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
        background: #ffffff !important;
        z-index: 10 !important;
      }
    }

    /* Compact Screens (<=521px) */
    @media (max-width: 521px) {
      .topbar {
        height: 50px !important;
        min-height: 50px !important;
      }

      body.view-team-chat .content {
        height: calc(100vh - 50px);
        height: calc(100dvh - 50px);
      }

      body.view-quo-messages .content {
        height: calc(100vh - 50px);
        height: calc(100dvh - 50px);
      }
    }

    @media (max-width: 480px) {
      .topbar {
        padding: 0 8px;
        gap: 6px;
      }

      .topbar-title {
        font-size: 15px;
      }

      .sidebar-toggle-btn {
        width: 32px;
        height: 32px;
      }

      .sidebar-toggle-btn svg {
        width: 18px;
        height: 18px;
      }

      #logActivityBtn {
        padding: 5px 8px;
        font-size: 11.5px;
      }

      .content {
        padding: 12px 8px;
      }

      .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
      }

      .kpi {
        padding: 12px 14px;
      }

      .kpi-value {
        font-size: 22px;
      }

      .drawer {
        width: 100vw !important;
        max-width: 100vw !important;
      }

      .drawer-head {
        padding: 16px;
      }

      .drawer-body {
        padding: 16px;
      }

      .drawer-foot {
        padding: 12px 16px;
      }
    }

    @media (hover: none) and (pointer: coarse) {

      .field select,
      .field input,
      .field textarea,
      .email-modal-card select,
      .email-modal-card input,
      .email-modal-card textarea {
        font-size: 16px;
      }
    }

    /* To / Cc / Bcc sit side by side on wide screens and stack on small phones, so nothing runs past the popup edge. */
    .modal-field-row>div {
      min-width: 0;
    }

    .email-modal-body .email-chips-wrap,
    .email-modal-body input[type="text"],
    .email-modal-body textarea {
      max-width: 100%;
      box-sizing: border-box;
    }

    @media (max-width: 600px) {
      .modal-field-row {
        flex-direction: column;
      }

      .email-modal-body {
        overflow-x: hidden;
      }
    }

    @media (max-width: 380px) {
      #userDisplayName {
        display: none !important;
      }
    }

    @media (max-width: 360px) {
      .topbar {
        padding: 0 6px;
        gap: 4px;
      }

      .topbar-title {
        font-size: 14px;
      }

      #logActivityBtn {
        padding: 4px 6px;
        font-size: 11px;
      }

      #logoutBtn {
        padding: 4px 5px;
        font-size: 11px;
      }

      .kpi-grid {
        grid-template-columns: 1fr;
      }

      .team-chat-msg-row {
        max-width: 92% !important;
      }

      .quo-msg-row {
        max-width: 92% !important;
      }

      .team-chat-composer-pill {
        padding: 4px 6px 4px 8px !important;
      }
    }

    /* ---------- INBOX PAGE (Front-style: list | conversation | details) ---------- */
    body.view-inbox .content {
      padding: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    body.view-inbox #content {
      flex: 1;
      min-height: 0;
    }

    .ib {
      display: grid;
      grid-template-columns: 330px minmax(0, 1fr) 300px;
      height: 100%;
      min-height: 0;
      background: var(--card);
    }

    .ib-list {
      display: flex;
      flex-direction: column;
      min-height: 0;
      border-right: 1px solid var(--border);
      background: var(--card);
    }

    .ib-list-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 16px 8px 16px;
    }

    .ib-list-title {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 800;
      font-size: 16px;
    }

    .ib-icon-btn {
      border: 0;
      background: none;
      color: var(--muted);
      font: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
    }

    .ib-icon-btn:hover {
      color: var(--text);
    }

    .ib-search-wrap {
      padding: 0 14px 8px 14px;
    }

    .ib-search {
      width: 100%;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font: inherit;
      font-size: 13px;
      background: var(--bg);
    }

    .ib-tabs {
      display: flex;
      gap: 2px;
      padding: 0 10px;
      border-bottom: 1px solid var(--row-border);
      overflow-x: auto;
    }

    .ib-tab {
      border: 0;
      background: none;
      padding: 8px 8px;
      font: inherit;
      font-size: 12.5px;
      font-weight: 500;
      color: var(--muted);
      cursor: pointer;
      border-bottom: 2px solid transparent;
      white-space: nowrap;
    }

    .ib-tab-n {
      font-size: 11px;
      font-weight: 600;
      color: var(--muted);
      background: var(--row-border);
      border-radius: 9px;
      padding: 0 6px;
      margin-left: 2px;
    }

    .ib-tab.active {
      color: var(--text);
      font-weight: 700;
      border-bottom-color: var(--text);
    }

    .ib-rows {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      background: var(--bg);
    }

    .ib-row {
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 10px 12px;
      cursor: pointer;
      background: var(--card);
    }

    .ib-row:hover {
      background: #FAFBFD;
    }

    .ib-row.selected {
      border-color: var(--accent);
      box-shadow: 0 0 0 1px var(--accent) inset;
    }

    .ib-row-top {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .ib-row-title {
      flex: 1;
      min-width: 0;
      font-weight: 600;
      font-size: 13px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .ib-row-time {
      flex: none;
      font-size: 11.5px;
      color: var(--muted-2);
    }

    .ib-row-sub {
      margin-top: 4px;
      font-size: 12px;
      color: var(--muted);
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .ib-row-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 6px;
    }

    .ib-row-chips:empty {
      display: none;
    }

    .ib-tag {
      font-size: 10.5px;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 6px;
      background: #EEF0F3;
      color: #4B5565;
    }

    .ib-tag-warn {
      background: #FFF0D6;
      color: #8A5A12;
    }

    .ib-note {
      padding: 18px 12px;
      color: var(--muted-2);
      font-size: 13px;
      line-height: 1.5;
    }

    .ib-err {
      color: var(--err);
    }

    .ib-faint {
      color: var(--muted-2);
      font-size: 12px;
    }

    .ib-more {
      margin: 4px auto 12px auto;
    }

    .ib-conv {
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
      border-right: 1px solid var(--border);
      background: var(--card);
    }

    .ib-conv-head {
      padding: 14px 20px 10px 20px;
      border-bottom: 1px solid var(--row-border);
    }

    .ib-back {
      display: none;
      border: 0;
      background: none;
      color: var(--accent);
      font: inherit;
      font-weight: 600;
      padding: 0 0 8px 0;
      cursor: pointer;
    }

    .ib-conv-title {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 800;
      font-size: 16px;
      margin-bottom: 8px;
      word-break: break-word;
    }

    .ib-conv-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }

    .ib-conv-chips,
    .ib-conv-state {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }

    .ib-pill {
      font-size: 12px;
      font-weight: 600;
      padding: 4px 10px;
      border: 1px solid var(--border);
      border-radius: 20px;
      background: var(--card);
    }

    .ib-thread {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      padding: 16px 20px;
      background: var(--bg);
    }

    .ib-msg {
      display: flex;
      gap: 10px;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px 14px;
      margin-bottom: 12px;
    }

    .ib-msg-out {
      border-left: 3px solid var(--accent);
    }

    .ib-msg-int {
      background: #FFF8E1;
      border-color: #F0D48A;
    }

    .ib-msg-av {
      flex: none;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: #E1E7EF;
      color: var(--text);
      display: grid;
      place-items: center;
      font-weight: 700;
      font-size: 11px;
    }

    .ib-msg-main {
      flex: 1;
      min-width: 0;
    }

    .ib-msg-head {
      display: flex;
      align-items: baseline;
      gap: 8px;
      flex-wrap: wrap;
    }

    .ib-msg-who {
      font-weight: 700;
      font-size: 13px;
    }

    .ib-msg-handle {
      color: var(--muted-2);
      font-size: 12px;
    }

    .ib-msg-time {
      margin-left: auto;
      font-size: 11.5px;
      color: var(--muted-2);
    }

    .ib-msg-body {
      margin-top: 6px;
      white-space: pre-wrap;
      word-break: break-word;
      font-size: 13.5px;
      line-height: 1.55;
    }

    .ib-atts {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 8px;
    }

    .ib-att {
      font-size: 12px;
      background: #F3F5F8;
      padding: 3px 8px;
      border-radius: 6px;
    }

    .ib-draft {
      border: 1px dashed var(--accent);
      background: #F5F8FF;
      border-radius: 12px;
      padding: 12px 14px;
    }

    .ib-draft-head {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
      font-size: 13px;
    }

    .ib-draft-body {
      white-space: pre-wrap;
      font-size: 13.5px;
      line-height: 1.55;
    }

    .ib-compose {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      padding: 12px 20px;
      border-top: 1px solid var(--border);
      background: var(--card);
      font-size: 13px;
      color: var(--muted);
    }

    /* SMS conversation of the Inbox page: a chat (customer left, us right) with a reply box */
    .ib-thread.ib-sms {
      display: flex;
      flex-direction: column;
      gap: 6px;
      background: #eef1f4;
    }

    .ib-sms-day {
      align-self: center;
      margin: 8px 0 4px;
    }

    .ib-sms-day span {
      display: inline-block;
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 2px 12px;
      font-size: 10.5px;
      font-weight: 600;
      letter-spacing: 0.05em;
      color: var(--muted, #64748b);
    }

    .ib-sms-row {
      display: flex;
    }

    .ib-sms-in {
      justify-content: flex-start;
    }

    .ib-sms-out {
      justify-content: flex-end;
    }

    .ib-sms-int {
      justify-content: center;
    }

    .ib-sms-bub {
      max-width: min(560px, 78%);
      padding: 8px 12px 6px;
      border-radius: 14px;
      background: #fff;
      border: 1px solid var(--border);
      font-size: 13.5px;
      line-height: 1.45;
      white-space: pre-wrap;
      overflow-wrap: anywhere;
    }

    .ib-sms-in .ib-sms-bub {
      border-bottom-left-radius: 4px;
    }

    .ib-sms-out .ib-sms-bub {
      background: #d9f5d3;
      border-color: #bfe8b6;
      border-bottom-right-radius: 4px;
    }

    .ib-sms-int .ib-sms-bub {
      background: #fff8e1;
      border-color: #f0d48a;
      font-size: 12.5px;
    }

    .ib-sms-time {
      display: block;
      text-align: right;
      margin-top: 2px;
      font-size: 10.5px;
      color: var(--muted, #64748b);
    }

    .ib-sms-compose {
      padding: 10px 16px 12px;
      border-top: 1px solid var(--border);
      background: var(--card);
    }

    .ib-sms-to {
      font-size: 12px;
      color: var(--muted, #64748b);
      margin-bottom: 6px;
    }

    .ib-sms-to select {
      font: inherit;
      font-size: 12px;
      padding: 2px 6px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--card);
    }

    .ib-sms-box {
      display: flex;
      gap: 8px;
      align-items: flex-end;
    }

    .ib-sms-box textarea {
      flex: 1;
      min-width: 0;
      resize: none;
      padding: 9px 12px;
      border: 1px solid var(--border);
      border-radius: 12px;
      font: inherit;
      font-size: 13.5px;
      line-height: 1.4;
      max-height: 140px;
      background: var(--card);
      color: inherit;
    }

    .ib-sms-box textarea:focus {
      outline: none;
      border-color: var(--accent, #0d9488);
    }

    .ib-sms-err {
      margin-top: 6px;
      font-size: 12.5px;
      color: #a11a1a;
    }

    .ib-empty {
      margin: auto;
      text-align: center;
      padding: 24px;
      color: var(--muted-2);
    }

    .ib-empty-mark {
      font-size: 34px;
    }

    .ib-empty-title {
      font-weight: 700;
      color: var(--text);
      margin-top: 6px;
    }

    .ib-ctx {
      min-height: 0;
      overflow-y: auto;
      padding: 8px 16px 16px 16px;
      background: var(--card);
    }

    .ib-ctx-sec {
      padding: 12px 0;
      border-bottom: 1px solid var(--row-border);
    }

    .ib-ctx-label {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--muted-2);
      margin-bottom: 8px;
    }

    .ib-person {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 6px;
    }

    .ib-person-name {
      font-weight: 700;
    }

    .ib-fact {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      padding: 2px 0;
      font-size: 12.5px;
    }

    .ib-fact span:first-child {
      color: var(--muted-2);
    }

    .ib-fact span:last-child {
      text-align: right;
      word-break: break-word;
    }

    .ib-account {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 4px;
    }

    .ib-link {
      border: 0;
      background: none;
      padding: 0;
      color: var(--accent);
      font: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
    }

    .ib-rr {
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 10px;
      margin-bottom: 6px;
      font-size: 12.5px;
    }

    .ib-notes {
      white-space: pre-wrap;
      word-break: break-word;
      font-size: 12.5px;
      color: var(--muted);
    }

    /* the Inbox folders in the sidebar panel */
    .nav-item.nav-sub {
      padding-left: 22px;
    }

    .nav-dot {
      display: inline-block;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      margin-right: 8px;
    }

    .nav-faint {
      padding: 4px 10px;
      font-size: 12px;
      color: var(--muted-2);
    }

    @media (max-width: 1280px) {
      .ib {
        grid-template-columns: 320px minmax(0, 1fr);
      }

      .ib-ctx {
        display: none;
      }
    }

    @media (max-width: 900px) {
      .ib {
        grid-template-columns: minmax(0, 1fr);
      }

      .ib-conv {
        display: none;
      }

      .ib.ib-reading .ib-list {
        display: none;
      }

      .ib.ib-reading .ib-conv {
        display: flex;
      }

      .ib-back {
        display: inline-block;
      }
    }
    /* a Save button that is working: small spinner before "Saving…" */
    .btn.is-saving { opacity: 0.85; cursor: progress; }

    .btn-spin {
      display: inline-block;
      width: 13px;
      height: 13px;
      margin-right: 8px;
      vertical-align: -2px;
      border: 2px solid rgba(255, 255, 255, 0.45);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 0.6s linear infinite;
    }
    /* ---------- TEAM INBOX: resizable list, Front-style bar, reply box ---------- */
    .ib-list {
      position: relative;
    }

    @media (min-width: 1281px) {
      .ib.ti {
        grid-template-columns: min(var(--ti-w, 340px), max(260px, calc(100% - 440px - var(--ti-cw, 300px)))) minmax(0, 1fr) var(--ti-cw, 300px);
      }
    }

    @media (min-width: 901px) and (max-width: 1280px) {
      .ib.ti {
        grid-template-columns: min(var(--ti-w, 340px), max(260px, calc(100% - 440px))) minmax(0, 1fr);
      }
    }

    .ti-resize {
      position: absolute;
      top: 0;
      right: -3px;
      width: 7px;
      height: 100%;
      cursor: col-resize;
      z-index: 5;
    }

    .ti-resize:hover,
    body.ti-dragging .ti-resize {
      background: rgba(36, 87, 214, 0.35);
    }

    body.ti-dragging {
      user-select: none;
      cursor: col-resize;
    }

    body.ti-dragging iframe {
      pointer-events: none;
    }

    @media (max-width: 900px) {
      .ti-resize {
        display: none;
      }
    }

    .ti-bar {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: flex-start;
      gap: 8px 14px;
    }

    .ti-title {
      flex: 1 1 180px;
      min-width: 0;
      margin: 3px 0 0 0;
      overflow-wrap: anywhere;
    }

    .ti-bar-left {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      align-items: center;
      gap: 8px;
      position: relative;
      margin-left: auto;
    }

    .ti-btn {
      border: 1px solid var(--border);
      background: var(--card);
      border-radius: 8px;
      padding: 6px 12px;
      font: inherit;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      color: var(--text);
      white-space: nowrap;
    }

    .ti-btn:hover {
      background: var(--bg);
    }

    .ti-caret {
      font-size: 10px;
      margin-left: 2px;
    }

    .ti-menu {
      position: absolute;
      top: 100%;
      right: 0;
      margin-top: 4px;
      min-width: 200px;
      max-height: 320px;
      overflow-y: auto;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
      padding: 4px;
      z-index: 30;
    }

    .ti-menu-item {
      display: block;
      width: 100%;
      text-align: left;
      border: 0;
      background: none;
      padding: 8px 10px;
      border-radius: 6px;
      font: inherit;
      font-size: 13px;
      cursor: pointer;
      color: var(--text);
    }

    .ti-menu-item:hover {
      background: var(--bg);
    }

    .ti-menu-item.on {
      font-weight: 700;
    }

    .ti-dot {
      display: inline-block;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      margin-right: 7px;
      vertical-align: -1px;
      box-sizing: border-box;
    }

    .ti-dot-open {
      border: 2px dashed #7C3AED;
    }

    .ti-dot-waiting {
      background: #D97706;
    }

    .ti-dot-resolved {
      background: #16A34A;
    }

    .ti-reply {
      border-top: 1px solid var(--border);
      padding: 12px 20px;
      background: var(--card);
    }

    .ti-reply textarea {
      width: 100%;
      box-sizing: border-box;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 12px;
      font: inherit;
      font-size: 13.5px;
      line-height: 1.5;
      resize: vertical;
      background: #fff;
    }

    .ti-reply-actions {
      display: flex;
      gap: 8px;
      margin-top: 8px;
    }

    .ti-reply-err {
      color: var(--err);
      font-size: 12.5px;
      margin-top: 6px;
    }

    .ti-bar-left {
      flex: none;
    }

    .ti-menu-up {
      top: auto;
      bottom: 100%;
      margin: 0 0 4px 0;
    }

    /* the reply box: compact, rich text, To / Cc / Bcc, split Send button */
    .ti-reply {
      padding: 10px 18px 12px 18px;
    }

    .ti-reply-form {
      border: 1px solid var(--border);
      border-radius: 10px;
      background: #fff;
      padding: 8px 12px 10px 12px;
      max-height: 46vh;
      overflow-y: auto;
    }

    .ti-rf-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 3px 0;
      border-bottom: 1px solid var(--row-border);
      font-size: 13px;
    }

    .ti-rf-label {
      width: 34px;
      flex: none;
      color: var(--muted-2);
    }

    .ti-rf-input {
      flex: 1;
      min-width: 0;
      border: 0;
      outline: 0;
      font: inherit;
      padding: 4px 0;
      background: transparent;
    }

    .ti-chip {
      background: #EEF0F3;
      border-radius: 6px;
      padding: 2px 8px;
      font-weight: 600;
      font-size: 12.5px;
    }

    .ti-rf-links {
      margin-left: auto;
      display: flex;
      gap: 10px;
    }

    .ti-link {
      border: 0;
      background: none;
      padding: 0;
      color: var(--muted);
      font: inherit;
      font-size: 12.5px;
      font-weight: 600;
      cursor: pointer;
    }

    .ti-link:hover {
      color: var(--accent);
    }

    .ti-editor {
      min-height: 70px;
      max-height: min(220px, 24vh);
      overflow-y: auto;
      padding: 10px 2px;
      outline: 0;
      font-size: 14px;
      line-height: 1.5;
    }

    .ti-editor:empty::before {
      content: attr(data-placeholder);
      color: var(--muted-2);
    }

    .ti-editor blockquote {
      margin: 6px 0;
      padding-left: 10px;
      border-left: 3px solid var(--border);
      color: var(--muted);
    }

    .ti-tools {
      display: flex;
      align-items: center;
      gap: 2px;
      padding-top: 6px;
      border-top: 1px solid var(--row-border);
    }

    .ti-tool {
      border: 0;
      background: none;
      min-width: 30px;
      height: 28px;
      border-radius: 6px;
      font: inherit;
      font-size: 13px;
      cursor: pointer;
      color: var(--text);
    }

    .ti-tool:hover {
      background: var(--bg);
    }

    .ti-tool-sep {
      width: 1px;
      height: 18px;
      background: var(--border);
      margin: 0 4px;
    }

    .ti-reply-actions {
      align-items: center;
    }

    .ti-split {
      position: relative;
      display: inline-flex;
    }

    .ti-send {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }

    .ti-send-caret {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
      border-left: 1px solid rgba(255, 255, 255, 0.4);
      padding-left: 10px;
      padding-right: 10px;
    }

    .ti-split .ti-menu {
      left: 0;
      right: auto;
    }

    .ti-frame {
      width: 100%;
      border: none;
      background: #fff;
      display: block;
    }

    .ti-tools2 {
      border-top: 0;
      padding-top: 4px;
    }

    .ti-tools {
      flex-wrap: wrap;
    }

    .ti-sel {
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--bg);
      padding: 5px 8px;
      font: inherit;
      font-size: 13px;
      max-width: 140px;
    }

    .ti-sel-sm {
      width: 62px;
    }

    .ti-color {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }

    .ti-color input[type=color] {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      opacity: 0;
      cursor: pointer;
      border: 0;
      padding: 0;
    }

    .ti-files {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin: 4px 0;
    }

    .ti-files:empty {
      display: none;
    }

    .ti-file {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: #EEF0F3;
      border-radius: 8px;
      padding: 3px 8px;
      font-size: 12.5px;
    }

    .ti-file-x {
      border: 0;
      background: none;
      cursor: pointer;
      color: var(--muted);
      font-size: 12px;
      padding: 0 2px;
    }

    .ti-editor img {
      max-width: 100%;
      height: auto;
    }

    .ti-emoji {
      display: grid;
      grid-template-columns: repeat(8, 1fr);
      gap: 2px;
      min-width: 0;
      width: 288px;
      padding: 6px;
    }

    .ti-emoji-btn {
      border: 0;
      background: none;
      font-size: 18px;
      padding: 4px;
      border-radius: 6px;
      cursor: pointer;
    }

    .ti-emoji-btn:hover {
      background: var(--bg);
    }

    /* pointer cursor on everything clickable in the team inbox */
    #tiBox,
    #tiBox option,
    .ti-sel,
    .ti-tool,
    .ti-btn,
    .ti-link,
    .ti-menu-item,
    .ti-send,
    .ti-send-caret,
    .ti-color,
    .ti-color input,
    .ib-tab,
    .ib-row,
    .ti-chip-x {
      cursor: pointer;
    }

    .ti-editor {
      cursor: text;
    }

    /* a pressed formatting button */
    .ti-tool.on {
      background: #DCE6FF;
      color: #1d4ed8;
      box-shadow: inset 0 0 0 1px #B7C9FF;
    }

    /* To / Cc / Bcc: addresses as chips */
    .ti-chipbox {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 4px;
      cursor: text;
      padding: 2px 0;
    }

    .ti-chipbox .ti-rf-input {
      flex: 1;
      min-width: 140px;
    }

    .ti-chip-mail {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: #E3EAFD;
      color: #1e3a8a;
      border-radius: 6px;
      padding: 2px 4px 2px 8px;
      font-size: 12.5px;
      font-weight: 600;
    }

    .ti-chip-bad {
      background: #FDE4E4;
      color: #b91c1c;
    }

    .ti-chip-x {
      border: 0;
      background: none;
      color: inherit;
      font-size: 11px;
      padding: 0 3px;
      opacity: 0.7;
    }

    .ti-chip-x:hover {
      opacity: 1;
    }

    /* Attach / Discard: clear, labelled buttons above the formatting bar */
    .ti-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin: 6px 0 8px 0;
      position: sticky;
      bottom: 0;
      background: #fff;
      z-index: 2;
      padding: 4px 0;
    }

    .ti-act {
      border: 1px solid var(--border);
      background: var(--card);
      border-radius: 8px;
      height: auto;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 600;
    }

    .ti-act:hover {
      background: var(--bg);
    }

    .ti-act-danger {
      color: #b91c1c;
    }

    .ti-act-danger:hover {
      background: #FDECEC;
    }

    .ti-tools {
      width: 100%;
      box-sizing: border-box;
    }

    /* read / unread, like Front: unread = blue dot + bold sender and subject; read = normal weight and softer colours */
    .ib-row.ti-unread .ti-from,
    .ib-row.ti-unread .ti-subj {
      font-weight: 700;
      color: var(--text);
    }

    .ib-row.ti-read .ti-from,
    .ib-row.ti-read .ti-subj {
      font-weight: 500;
      color: var(--muted);
    }

    .ib-row.ti-read .ib-row-sub {
      color: var(--muted-2);
    }

    .ib-row.ti-unread .ib-row-time {
      color: var(--text);
      font-weight: 600;
    }

    .ti-dotmark {
      flex: none;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #4F46E5;
    }

    .ti-row-read {
      flex: none;
      border: 0;
      background: none;
      color: var(--muted-2);
      font-size: 12px;
      line-height: 1;
      padding: 2px 4px;
      border-radius: 6px;
      cursor: pointer;
      opacity: 0;
      width: 0;
      overflow: hidden;
      transition: opacity 0.12s;
    }

    .ib-row:hover .ti-row-read,
    .ib-row.selected .ti-row-read {
      opacity: 1;
      width: auto;
    }

    .ti-row-read:hover {
      background: var(--bg);
      color: var(--text);
    }

    .ti-badge {
      margin-left: auto;
    }

    /* a spinner inside a normal (not blue) button */
    .btn:not(.btn-primary) .btn-spin {
      border-color: rgba(51, 65, 85, 0.25);
      border-top-color: #334155;
    }

    .ib-more:disabled {
      opacity: 0.8;
      cursor: progress;
    }

    /* attachments under a message in the team inbox */
    .ti-atts {
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px dashed var(--border);
    }

    .ti-atts-label {
      font-size: 11.5px;
      font-weight: 700;
      color: var(--muted);
      margin-bottom: 8px;
    }

    .ti-atts-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .ti-att {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      border: 1px solid var(--border);
      background: #FAFBFD;
      border-radius: 10px;
      padding: 6px 10px;
      font: inherit;
      font-size: 12px;
      color: var(--text);
      cursor: pointer;
      max-width: 100%;
    }

    .ti-att:hover {
      background: #F0F2F5;
    }

    .ti-att-name {
      font-weight: 600;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: 220px;
    }

    .ti-att-img {
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
      padding: 6px;
      width: 150px;
    }

    .ti-att-img img {
      width: 138px;
      height: 96px;
      object-fit: cover;
      border-radius: 6px;
      background: #E5E9F0;
    }

    .ti-att-img .ti-att-name {
      max-width: 138px;
    }

    /* subjects and long words never push the page wider */
    .ti-title,
    .ib-row-title,
    .ib-msg-who,
    .ib-msg-handle {
      overflow-wrap: anywhere;
    }

    /* ---------- TEAM INBOX ON A PHONE ---------- */
    @media (max-width: 900px) {
      .ib .ib-conv-head {
        padding: 10px 14px 12px 14px;
      }

      /* the subject gets the whole width; Assign and the status sit on their own row below it */
      .ti-bar {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 10px;
      }

      .ti-title {
        flex: 0 0 auto;
        font-size: 15.5px;
        line-height: 1.3;
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }

      .ti-bar-left {
        width: 100%;
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 8px;
      }

      .ti-bar-left .ti-btn {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 42px;
        padding: 10px 8px;
        font-size: 14px;
        line-height: 1.2;
        text-align: center;
        white-space: nowrap;
      }

      .ti-bar-left .ti-btn.ti-plus {
        flex: 0 0 44px;
        min-width: 44px;
        font-size: 20px;
        padding: 6px 0;
      }

      .ti-menu {
        min-width: 0;
        max-width: calc(100vw - 28px);
      }

      .ib-thread {
        padding: 10px;
      }

      .ib-msg {
        padding: 10px;
        gap: 8px;
        margin-bottom: 10px;
      }

      .ib-msg-av {
        width: 26px;
        height: 26px;
        font-size: 10px;
      }

      .ib-msg-head {
        gap: 2px 8px;
      }

      .ib-msg-time {
        margin-left: 0;
        width: 100%;
      }

      .ib-msg-body {
        font-size: 14px;
      }

      .ti-atts-list {
        gap: 6px;
      }

      .ti-att-name {
        max-width: 160px;
      }

      /* the reply box uses the width it has */
      .ti-reply {
        padding: 8px 10px 10px 10px;
      }

      .ti-reply-form {
        padding: 6px 8px 8px 8px;
      }

      .ti-rf-label {
        width: 30px;
      }

      .ti-tools {
        gap: 4px;
      }

      .ti-sel {
        max-width: 112px;
        padding: 6px 4px;
      }

      .ti-sel-sm {
        width: 56px;
      }

      .ti-tool {
        min-width: 32px;
        height: 32px;
      }

      .ti-actions {
        gap: 6px;
      }

      .ti-act {
        padding: 8px 10px;
        font-size: 12.5px;
      }

      .ti-split {
        margin-left: auto;
      }

      .ti-emoji {
        width: 250px;
      }
    }

    /* the "Add a link" window */
    .ti-modal-back {
      position: fixed;
      inset: 0;
      z-index: 3000;
      background: rgba(15, 23, 42, 0.45);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }

    .ti-modal {
      width: min(100%, 420px);
      background: var(--card);
      border-radius: 14px;
      box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
      padding: 18px 18px 16px 18px;
    }

    .ti-modal-title {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 800;
      font-size: 16px;
      margin-bottom: 12px;
    }

    .ti-modal-label {
      display: block;
      font-size: 12px;
      font-weight: 700;
      color: var(--muted);
      margin: 10px 0 5px 0;
    }

    .ti-modal-input {
      width: 100%;
      box-sizing: border-box;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 9px 11px;
      font: inherit;
      font-size: 14px;
      background: #fff;
    }

    .ti-modal-input:focus {
      outline: 2px solid #B7C9FF;
      border-color: var(--accent);
    }

    .ti-modal-err {
      color: var(--err);
      font-size: 12.5px;
      margin-top: 8px;
    }

    .ti-modal-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 16px;
    }

    /* end of the team inbox list: the marker that is watched, and the "Loading more" line */
    .ti-endmark {
      flex: none;          /* the list is a flex column: without this the marker is squeezed to nothing */
      height: 24px;
    }

    .ti-loadingmore {
      flex: none;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 14px 0;
      color: var(--muted);
      font-size: 13px;
    }

    .ti-loadingmore .btn-spin {
      margin-right: 0;
      border-color: rgba(51, 65, 85, 0.25);
      border-top-color: #334155;
    }

    /* ---- live new mail (public/js/mail-live.js) ---- */
    .mail-bell {
      padding: 4px 8px;
      font-size: 15px;
      line-height: 1;
    }

    .mail-bell.off {
      opacity: 0.45;
      filter: grayscale(1);
    }

    .ml-bar {
      position: fixed;
      top: 70px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 8000;
      border: 0;
      border-radius: 999px;
      padding: 8px 16px;
      background: #2457D6;
      color: #fff;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      box-shadow: 0 6px 20px rgba(36, 87, 214, 0.35);
    }

    .ml-pop {
      position: fixed;
      z-index: 9500;
      width: min(290px, calc(100vw - 16px));
      padding: 12px 14px;
      background: var(--panel, #fff);
      color: var(--fg, #0f172a);
      border: 1px solid var(--border, #e2e8f0);
      border-radius: 10px;
      box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
      font-size: 13px;
    }

    .ml-pop label {
      display: flex;
      gap: 8px;
      align-items: flex-start;
      margin: 6px 0;
      cursor: pointer;
    }

    /* a row that has just arrived */
    .ib-row.ti-new {
      animation: ti-new-glow 6s ease-out;
    }

    @keyframes ti-new-glow {
      0%, 60% { background: #eaf1ff; box-shadow: inset 3px 0 0 #2457D6; }
      100% { background: transparent; box-shadow: none; }
    }

    /* the question about desktop notifications: a small card at the top of the page */
    .ml-ask {
      position: fixed;
      top: 14px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 9600;
      display: flex;
      align-items: center;
      gap: 10px;
      width: max-content;
      max-width: calc(100vw - 24px);
      padding: 10px 12px 10px 16px;
      background: var(--card, #fff);
      color: var(--text, #0f172a);
      border: 1px solid var(--border, #e2e8f0);
      border-radius: 12px;
      box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
      animation: ml-drop 0.2s ease-out;
    }

    .ml-ask-text {
      display: flex;
      flex-direction: column;
      gap: 1px;
      font-size: 13px;
      min-width: 0;
    }

    .ml-ask-text span {
      color: var(--muted, #64748b);
      font-size: 12px;
    }

    .ml-ask .btn {
      flex: none;
      white-space: nowrap;
    }

    @keyframes ml-drop {
      from { opacity: 0; transform: translate(-50%, -10px); }
      to { opacity: 1; transform: translate(-50%, 0); }
    }

    /* Notifications section of the account card */
    .rail-pop-notify {
      margin: 0 0 10px;
      padding: 10px 0;
      border-top: 1px solid var(--border);
      border-bottom: 1px solid var(--border);
    }

    .ml-set-title {
      margin-bottom: 6px;
      font-size: 10.5px;
      font-weight: 700;
      text-transform: uppercase;
      color: var(--muted, #64748b);
    }

    .ml-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin: 4px 0;
      font-size: 12.5px;
      cursor: pointer;
    }

    .ml-row.off {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .ml-set-note {
      margin: 2px 0 6px;
      font-size: 11px;
      line-height: 1.4;
      color: var(--muted, #64748b);
    }

    .ml-sw {
      position: relative;
      flex: none;
      width: 32px;
      height: 18px;
    }

    .ml-sw input {
      position: absolute;
      inset: 0;
      opacity: 0;
      margin: 0;
      cursor: inherit;
    }

    .ml-sw i {
      position: absolute;
      inset: 0;
      border-radius: 999px;
      background: #cbd5e1;
      transition: background 0.15s;
      pointer-events: none;
    }

    .ml-sw i::after {
      content: '';
      position: absolute;
      top: 2px;
      left: 2px;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: #fff;
      transition: transform 0.15s;
    }

    .ml-sw input:checked + i {
      background: #2457D6;
    }

    .ml-sw input:checked + i::after {
      transform: translateX(14px);
    }

    /* on a desktop the account card holds the notification settings; the bell is for phones */
    @media (min-width: 1025px) {
      .mail-bell {
        display: none;
      }
    }

    /* ---- notes with @mentions in a team-inbox conversation ---- */
    .ti-plus {
      min-width: 32px;
      padding-left: 8px;
      padding-right: 8px;
      font-size: 15px;
      font-weight: 700;
    }

    .ti-note {
      background: #fdf1f4;
      border-color: #f4cbd6;
    }

    .ti-note-av {
      background: #fadbe4;
      font-size: 14px;
    }

    .ti-note-tag {
      margin-left: 8px;
      padding: 1px 6px;
      border-radius: 999px;
      background: #fadbe4;
      color: #a12a4d;
      font-size: 10.5px;
      font-weight: 700;
      text-transform: uppercase;
    }

    .ti-note-body {
      margin-top: 4px;
      font-size: 13.5px;
      line-height: 1.5;
      overflow-wrap: anywhere;
    }

    .ti-note-av .ti-ico {
      width: 16px;
      height: 16px;
      color: #a12a4d;
    }

    .ti-note-edit {
      margin-left: auto;
      border: 0;
      background: none;
      color: #a12a4d;
      font: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      padding: 0 2px;
    }

    .ti-note-edit:hover {
      text-decoration: underline;
    }

    .ti-edited {
      margin-left: 8px;
      font-size: 11px;
      color: var(--muted, #64748b);
    }

    .ti-note-editbox {
      margin-top: 6px;
    }

    .ti-comment-btn .ti-ico {
      margin-right: 4px;
    }

    .ti-mention {
      padding: 0 3px;
      border-radius: 4px;
      background: #e3ecff;
      color: #2457D6;
      font-weight: 600;
    }

    .ti-mention.me {
      background: #2457D6;
      color: #fff;
    }

    .ti-notebox {
      margin: 12px 0;
      padding: 12px;
      border: 1px solid #f4cbd6;
      border-radius: 12px;
      background: #fdf1f4;
    }

    .ti-notebox-head {
      margin-bottom: 8px;
      font-size: 13px;
      font-weight: 700;
    }

    .ti-notebox-head .ib-faint {
      margin-left: 6px;
      font-weight: 400;
    }

    .ti-notebox-wrap {
      position: relative;
    }

    .ti-notebox-text {
      width: 100%;
      resize: vertical;
      padding: 8px 10px;
      border: 1px solid var(--border, #e2e8f0);
      border-radius: 8px;
      font: inherit;
      font-size: 13.5px;
      background: #fff;
    }

    .ti-sugg {
      position: absolute;
      left: 8px;
      bottom: 100%;
      z-index: 20;
      min-width: 200px;
      max-width: calc(100% - 16px);
      margin-bottom: 4px;
      padding: 4px;
      background: var(--card, #fff);
      border: 1px solid var(--border, #e2e8f0);
      border-radius: 8px;
      box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
    }

    .ti-sugg[hidden] {
      display: none;
    }

    .ti-sugg-item {
      display: block;
      width: 100%;
      padding: 6px 10px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      text-align: left;
      font-size: 13px;
      cursor: pointer;
    }

    .ti-sugg-item.on,
    .ti-sugg-item:hover {
      background: #e3ecff;
    }

    .ti-notebox-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 8px;
    }

    /* the other Inbox folders (Needs reply, Mentions ...) use the same draggable list width as the team inboxes */
    @media (min-width: 1281px) {
      .ib.ib-sized {
        grid-template-columns: min(var(--ti-w, 330px), max(260px, calc(100% - 440px - var(--ti-cw, 300px)))) minmax(0, 1fr) var(--ti-cw, 300px);
      }
    }

    @media (min-width: 901px) and (max-width: 1280px) {
      .ib.ib-sized {
        grid-template-columns: min(var(--ti-w, 320px), max(260px, calc(100% - 440px))) minmax(0, 1fr);
      }
    }

    /* details panel on the right of the Inbox / team inbox: the same type as the rest of the CRM */
    .ib-ctx {
      font-size: 13px;
    }

    .ib-ctx-label {
      font-size: 10.5px;
    }

    .ib-person {
      align-items: flex-start;
    }

    .ib-person .ib-msg-av {
      flex: none;
    }

    .ib-person-name {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-size: 14px;
      font-weight: 700;
      line-height: 1.3;
      overflow-wrap: anywhere;
    }

    .ib-person .ib-faint {
      font-size: 12px;
      overflow-wrap: anywhere;
    }

    .ib-fact {
      padding: 3px 0;
      font-size: 13px;
    }

    .ib-fact span:first-child {
      flex: none;
    }

    /* the Assign menu lists everybody: scrolls, with small headings */
    .ti-menu-scroll {
      max-height: 320px;
      overflow-y: auto;
      min-width: 220px;
    }

    .ti-menu-label {
      padding: 8px 12px 3px;
      font-size: 10.5px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--muted-2, #94a3b8);
    }

    /* Admin > Mailboxes & channels: four dropdowns */
    .mb-picks {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 14px 18px;
    }

    .mb-pick {
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-width: 0;
    }

    .mb-pick-sel {
      width: 100%;
      padding: 8px 10px;
      text-overflow: ellipsis;
    }

    .mb-pick-note {
      font-size: 12px;
      color: var(--muted-2, #94a3b8);
    }

    /* Telegram / SMS / Teams conversations in a team inbox */
    .ti-chan {
      background: #e0f2fe;
      color: #075985;
      font-weight: 600;
    }

    /* the always-open message box of a Telegram / SMS / Teams conversation */
    .ti-chan-composer .ti-reply-form {
      display: block;
      padding: 10px 14px;
    }

    .ti-ms-connect {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
      padding: 8px 12px;
      margin-bottom: 8px;
      background: #fff7ed;
      border: 1px solid #fed7aa;
      border-radius: 10px;
    }

    .ti-ms-text {
      font-size: 12.5px;
      font-weight: 600;
      color: #7c2d12;
    }

    .ti-ms-btn {
      background: #ea580c;
      border-color: #ea580c;
      white-space: nowrap;
    }

    .ti-chan-row {
      display: flex;
      align-items: flex-end;
      gap: 10px;
    }

    .ti-resolve-line { display: flex; justify-content: flex-end; margin-top: 6px; }
    .ti-resolve-line .ti-resolve { margin-right: 0; }
    .ti-chan-text {
      flex: 1;
      min-width: 120px;
      box-sizing: border-box;
      min-height: 40px;
      max-height: 150px;
      padding: 9px 12px;
      border: 1px solid var(--border, #e2e8f0);
      border-radius: 12px;
      font: inherit;
      font-size: 14px;
      line-height: 1.45;
      resize: none;
      overflow-y: auto;
    }

    .ti-chan-text:focus {
      outline: none;
      border-color: var(--accent, #0d9488);
    }

    .ib-thread.ti-chat {
      display: flex;
      flex-direction: column;
      gap: 6px;
      background: #eef1f4;
    }

    .ib-thread.ti-chat .ib-msg {
      align-self: stretch;
    }

    .ti-chan-files {
      font-size: 12px;
      color: var(--muted);
      margin-top: 4px;
    }

    /* custom SLA goal: a number box and a Set button inside the SLA menu */
    .ti-sla-custom {
      display: flex;
      gap: 6px;
      align-items: center;
      padding: 4px 8px 8px;
    }

    .ti-sla-custom input {
      flex: 1;
      min-width: 0;
      width: 90px;
      padding: 6px 8px;
      border: 1px solid var(--border, #e2e8f0);
      border-radius: 8px;
      font: inherit;
      font-size: 13px;
    }

    .ti-sla-custom .ti-menu-item {
      width: auto;
      font-weight: 600;
    }

    /* ticket id and SLA state of a conversation in the team inbox lists */
    .ti-ticket {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 10.5px;
      letter-spacing: 0.03em;
      color: var(--muted, #64748b);
    }

    .ti-ticket-head {
      margin-left: 8px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 11px;
      font-weight: 600;
      color: var(--muted, #64748b);
      white-space: nowrap;
    }

    .ti-sla {
      font-weight: 600;
    }

    .ti-sla-ok {
      background: #e8f7ee;
      color: #0f6b3b;
    }

    .ti-sla-warn {
      background: #fff4db;
      color: #8a5a00;
    }

    .ti-sla-bad {
      background: #fde8e8;
      color: #a11a1a;
    }

    .ti-sla-off {
      background: #eef1f5;
      color: #64748b;
    }

    /* topic tag the AI gives a conversation */
    .ti-topic {
      background: #ece9fe;
      color: #4b3bb3;
      font-weight: 600;
    }

    .ti-topic-also {
      background: #f3f1ff;
      color: #6a5bd0;
      font-weight: 500;
    }

    /* the reply Hermes wrote automatically, shown in the conversation like a card */
    .ti-hermes {
      background: #f6f4ff;
      border-color: #ddd6fe;
    }

    .ti-hermes-av {
      background: #ede9fe;
      color: #5b21b6;
      font-weight: 700;
      font-size: 10.5px;
    }

    .ti-hermes-draft {
      background: #ede9fe;
      color: #5b21b6;
      font-weight: 600;
    }

    .ti-hermes-ok {
      background: #e8f7ee;
      color: #0f6b3b;
      font-weight: 600;
    }

    .ti-hermes-why {
      margin-top: 4px;
      font-size: 12.5px;
      color: #8a5a00;
    }

    .ti-hermes-body {
      white-space: pre-wrap;
    }

    /* tags under the title of an open conversation, and the tags people add by hand */
    .ti-tagbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 6px;
      margin-top: 8px;
    }

    .ti-mtag {
      background: #eef1f5;
      color: #334155;
      font-weight: 500;
    }

    .ti-mtag-x {
      border: 0;
      background: transparent;
      color: inherit;
      cursor: pointer;
      font-size: 13px;
      line-height: 1;
      margin-left: 4px;
      padding: 0 1px;
      opacity: 0.6;
    }

    .ti-mtag-x:hover {
      opacity: 1;
    }

    .ti-tagadd {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      border: 1px dashed var(--border, #cbd5e1);
      background: transparent;
      color: var(--muted, #64748b);
      border-radius: 999px;
      padding: 2px 10px 2px 7px;
      font: inherit;
      font-size: 11.5px;
      cursor: pointer;
    }

    .ti-tagadd:hover {
      border-color: #4b3bb3;
      color: #4b3bb3;
    }

    .ti-tagadd .ti-ico {
      width: 12px;
      height: 12px;
    }

    /* the box where a tag is typed, with its own dropdown (not the browser's) */
    .ti-tagpick {
      position: relative;
      display: inline-block;
    }

    .ti-taginput {
      border: 1px solid var(--border, #cbd5e1);
      border-radius: 999px;
      padding: 3px 12px;
      font: inherit;
      font-size: 12px;
      width: 190px;
      background: var(--card, #fff);
      color: inherit;
      outline: none;
    }

    .ti-taginput:focus {
      border-color: #4b3bb3;
      box-shadow: 0 0 0 3px rgba(75, 59, 179, 0.15);
    }

    .ti-tagmenu {
      left: 0;
      right: auto;
      top: 100%;
      margin-top: 6px;
      min-width: 230px;
      max-height: 260px;
    }

    .ti-tagmenu .ti-menu-item.on {
      background: var(--bg);
      font-weight: 600;
    }

    /* small line icons (tag, note, plus) */
    .ti-ico {
      flex: none;
      vertical-align: -2px;
    }

    .ti-menu-item .ti-ico {
      margin-right: 8px;
      color: var(--muted, #64748b);
    }

    .ti-topic .ti-ico {
      margin-right: 4px;
      width: 12px;
      height: 12px;
    }

    .ti-tag-none {
      font-size: 11.5px;
      color: var(--muted, #94a3b8);
    }

    /* ---- Admin > SLA settings ---- */
    .sla-page { max-width: 760px; display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; }
    .sla-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; }
    .sla-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
    .sla-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; color: var(--text); }
    .sla-head p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); max-width: 560px; }
    .sla-head p b { color: var(--text); font-weight: 600; }
    .sla-row { display: flex; align-items: flex-end; gap: 18px; margin-top: 18px; flex-wrap: wrap; }
    .sla-field { display: flex; flex-direction: column; gap: 6px; }
    .sla-grow { flex: 1 1 320px; }
    .sla-field label { font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
    .sla-inline { display: flex; align-items: center; gap: 10px; }
    .sla-inline input[type=number], .sla-inline select { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: #fff; font: inherit; font-size: 15px; color: var(--text); }
    .sla-inline input[type=number] { width: 110px; }
    .sla-inline input:focus, .sla-inline select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
    .sla-total { font-size: 15px; font-weight: 600; color: var(--accent); padding-bottom: 9px; }
    .sla-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
    .sla-chip { border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
    .sla-chip:hover { border-color: var(--accent); color: var(--accent); }
    .sla-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
    .sla-off-note { margin-top: 14px; font-size: 13px; color: var(--muted); background: var(--header-row-bg); border: 1px dashed var(--border); border-radius: 9px; padding: 10px 12px; }
    .sla-switch { position: relative; flex: 0 0 auto; width: 46px; height: 26px; cursor: pointer; margin-top: 2px; }
    .sla-switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
    .sla-switch-track { position: absolute; inset: 0; background: #c5ccd6; border-radius: 999px; transition: background .15s; pointer-events: none; }
    .sla-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
    .sla-switch input:checked + .sla-switch-track { background: var(--accent); }
    .sla-switch input:checked + .sla-switch-track::after { transform: translateX(20px); }
    .sla-switch input:focus-visible + .sla-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
    #slaRisk { -webkit-appearance: none; appearance: none; flex: 1 1 auto; height: 6px; border-radius: 999px; outline: none; background: linear-gradient(to right, var(--accent) var(--sla-fill, 70%), #d9dfe8 var(--sla-fill, 70%)); }
    #slaRisk::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
    #slaRisk::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: pointer; }
    #slaRiskOut { min-width: 52px; text-align: right; font-size: 18px; font-weight: 650; color: var(--text); }
    .sla-preview .sla-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; margin-top: 18px; background: #fde8e8; }
    .sla-seg { display: block; height: 100%; flex: 0 0 auto; }
    .sla-seg-ok { background: #34b27b; }
    .sla-seg-warn { background: #f5b83d; }
    .sla-seg-bad { flex: 0 0 0; }
    .sla-marks { position: relative; height: 20px; margin-top: 6px; font-size: 12px; color: var(--muted); }
    .sla-marks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
    .sla-marks span:first-child { transform: none; }
    .sla-marks span:last-child { transform: translateX(-100%); }
    .sla-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
    .sla-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
    .sla-msg { font-size: 13px; color: var(--muted); }
    .sla-msg.err { color: var(--err); }
    .sla-note { font-size: 13px; color: var(--muted); background: var(--accent-soft); border-radius: 9px; padding: 10px 12px; line-height: 1.5; }
    @media (max-width: 640px) {
      .sla-card { padding: 16px; }
      .sla-head { gap: 12px; }
      .sla-inline input[type=number] { width: 90px; }
    }
    .sla-actions [hidden] { display: none !important; }

    /* ---- Admin > SLA settings > Team goals: one row per team ---- */
    .sla-trows { display: flex; flex-direction: column; margin-top: 14px; border-top: 1px solid var(--row-border, var(--border)); }
    .sla-trow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; padding: 14px 4px; border-bottom: 1px solid var(--row-border, var(--border)); }
    .sla-trow .sla-tname { flex: 1 1 220px; align-self: center; }
    .sla-trow .sla-switch, .sla-trow .sla-tmode { align-self: center; }
    .sla-trow .sla-tcol { flex: 0 1 205px; }
    .sla-trow .sla-tact { flex: 1 1 100%; flex-direction: row; align-items: center; gap: 12px; margin-top: 2px; }      /* Save on its own line, under the fields */
    .ti-sev { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
    .ti-sev-urgent { background: #fde8e8; color: #b42318; }
    .ti-sev-high { background: #fff1dc; color: #b54708; }
    .sla-trow-default { background: var(--header-row-bg, #f6f8fb); border-radius: 10px; padding-left: 12px; padding-right: 12px; margin-bottom: 4px; border-bottom: 0; }
    .sla-trow-off .sla-tcol { opacity: .55; }
    .sla-tname { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
    .sla-tname b { font-size: 14px; color: var(--text); }
    .sla-tname .ib-faint { font-size: 12px; line-height: 1.4; }
    .sla-tmode { font-size: 12px; font-weight: 600; color: var(--muted); }
    .sla-tcol { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
    .sla-tcol label { font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
    .sla-trow .sla-inline { gap: 6px; }
    .sla-trow .sla-inline input[type=number], .sla-trow .sla-inline select { height: 34px; padding: 0 8px; font-size: 13.5px; border-radius: 8px; }
    .sla-trow .sla-inline input[type=number] { width: 80px; }
    .sla-trow .sla-inline input:disabled, .sla-trow .sla-inline select:disabled { background: #f1f3f6; color: var(--muted); cursor: not-allowed; }
    .sla-tact { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
    .sla-tact .btn { padding: 6px 16px; }
    .ti-unknown { background: #FEF3C7; color: #92400E; border-color: #FCD34D; font-weight: 600; }
    .key-cell { text-align: center; }
    .key-cb { width: 16px; height: 16px; cursor: pointer; accent-color: #CA8A04; }
    .key-cb:disabled { cursor: not-allowed; opacity: .5; }
    .ti-dlg.cl-dlg { width: min(780px, 94vw); max-width: none; padding: 20px 22px; }
    .ti-dlg.cl-dlg h3 { margin: 0 0 4px; }
    .cl-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 12px; }
    .cl-cols .ib-ctx-label { margin-bottom: 6px; }
    .cl-err { color: var(--danger, #B91C1C); font-size: 13px; padding: 8px; }
    .cl-res { display: block; min-height: 150px; max-height: min(300px, 40vh); overflow-y: auto; overflow-x: hidden; align-content: start; gap: 6px; padding-right: 4px; scrollbar-width: thin; border: 1px solid var(--row-border); border-radius: 10px; padding: 6px; background: var(--card); }
    .ti-dlg.cl-dlg .sc-item { font-size: 13px; padding: 7px 10px; border-radius: 8px; display: block; width: 100%; box-sizing: border-box; margin: 0 0 6px; min-width: 0; }
    .cl-dlg .sc-item b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cl-dlg .sc-item span { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cl-dlg .sc-item.on { border-color: var(--accent); background: var(--accent-soft); }
    .cl-dlg .sc-item.on b::before { content: '✓ '; color: var(--accent); }
    .cl-add { background: transparent; color: var(--muted); border: 1px dashed var(--border); cursor: pointer; }
    .cl-add:hover { color: var(--accent); border-color: var(--accent); }
    @media (max-width: 640px) { .cl-cols { grid-template-columns: 1fr; } }
    .cl-box { background: var(--card); border: 1px solid var(--row-border); border-radius: 10px; padding: 10px 12px; }
    .cl-line { display: flex; gap: 10px; margin-bottom: 8px; font-size: 13px; }
    .cl-k { width: 62px; flex: none; color: var(--muted); font-size: 12px; padding-top: 1px; }
    .cl-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
    .cl-chip { background: #EEF2FF; color: #3730A3; border-color: #C7D2FE; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cl-key, .ib-tag.cl-key { background: #FEF9C3; color: #854D0E; border-color: #FDE047; font-weight: 600; }
    .ti-unknown-box { background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 10px; padding: 10px 12px; }
    .sc-dlg { max-width: 520px; max-height: 90vh; overflow: auto; }
    .sc-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
    .sc-tab { flex: 1; border: 1px solid var(--border); background: var(--card); color: var(--muted); border-radius: 8px; padding: 7px 8px; font-size: 13px; cursor: pointer; }
    .sc-tab.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
    .sc-pane[hidden] { display: none; }
    .sc-in { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--card); color: var(--text); }
    .sc-lab { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 3px; }
    .sc-lab .sc-in { margin-top: 3px; }
    .sc-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
    .sc-results { max-height: 180px; overflow: auto; margin: 6px 0; display: grid; gap: 4px; }
    .sc-item { text-align: left; border: 1px solid var(--row-border); background: var(--card); color: var(--text); border-radius: 8px; padding: 7px 10px; cursor: pointer; display: grid; gap: 1px; font: inherit; }
    .sc-item span { font-size: 12px; color: var(--muted); }
    .sc-item:hover { border-color: var(--accent); }
    .sc-item.on { border-color: var(--accent); background: var(--accent-soft); }
    .sc-picked { font-size: 13px; margin: 4px 0; }
    #tiAssignBtn { max-width: min(380px, 70vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .feed-banner { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13.5px; border-bottom: 1px solid; }
    .feed-banner[hidden] { display: none; }
    .feed-warn { background: #FEF3C7; color: #78350F; border-color: #FCD34D; }
    .feed-bad { background: #FEE2E2; color: #7F1D1D; border-color: #FCA5A5; }
    .feed-banner .feed-text { flex: 1; }
    .feed-banner .feed-link { font-weight: 600; color: inherit; text-decoration: underline; white-space: nowrap; }
    .fh-rows { display: grid; container-type: inline-size; }
    /* one line per mailbox: name | status + last mail | quiet | stale-after limit. The cells WRAP (flex) when the card is narrow, so nothing overlaps and "business hours" stays on one line */
    .fh-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 0; border-top: 1px solid var(--row-border); }
    .fh-name, .fh-state { display: grid; gap: 3px; min-width: 0; align-content: center; }
    .fh-name { flex: 1 1 170px; overflow-wrap: anywhere; }
    .fh-state { flex: 1 1 150px; }
    .fh-quiet { flex: 0 0 96px; }
    .fh-quiet span { white-space: nowrap; font-size: 14px; }
    .fh-limit { flex: 0 0 auto; }
    .fh-limit .sla-inline { gap: 8px; white-space: nowrap; font-size: 13px; color: var(--muted); }
    .fh-quiet label, .fh-limit label { display: block; font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .03em; }
    .fh-badge { display: inline-block; width: max-content; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
    .fh-healthy { background: #DCFCE7; color: #166534; } .fh-stale { background: #FEF3C7; color: #92400E; } .fh-disconnected { background: #FEE2E2; color: #991B1B; }
    .fh-limit .sla-inline input[type=number].fh-in { width: 72px; height: 34px; padding: 0 8px; font-size: 14px; text-align: center; border-radius: 8px; }
    .fh-strip { background: #FEF2F2; border: 1px solid #FECACA; border-radius: 10px; margin: 8px; padding: 8px 12px; }
    .fh-strip-ok { background: #F0FDF4; border-color: #BBF7D0; color: #166534; font-size: 13px; }
    .fh-strip-head { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
    .fh-alert { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--row-border); }
    .fh-strip .fh-alert:first-of-type { border-top: 0; }
    .fh-alert-main { display: grid; gap: 1px; min-width: 0; font-size: 13px; }
    /* a wide card: four fixed columns, so every column starts at exactly the same place in every row */
    @container (min-width: 600px) { .fh-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 96px max-content; gap: 0 14px; } }
    @media (max-width: 800px) { .fh-row { gap: 6px 16px; } .fh-name, .fh-state { flex-basis: 100%; } }
    .ti-resolve { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-right: 10px; cursor: pointer; user-select: none; white-space: nowrap; }
    .ti-resolve input { margin: 0; cursor: pointer; }
    .ti-dlg-back { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 27, 45, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
    .ti-dlg { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 50px rgba(15, 27, 45, .28); width: 100%; max-width: 420px; padding: 20px 22px 18px; }
    .ti-dlg h3 { margin: 0 0 6px; font-size: 17px; }
    .ti-dlg-text { margin: 0 0 12px; font-size: 14px; line-height: 1.45; color: var(--muted); }
    .ti-dlg-meta { background: var(--header-row-bg); border: 1px solid var(--row-border); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; display: grid; gap: 4px; }
    .ti-dlg-meta div { display: flex; gap: 10px; }
    .ti-dlg-meta span { color: var(--muted-2); width: 36px; flex: none; }
    .ti-dlg-meta b { font-weight: 600; word-break: break-all; }
    .ti-dlg-act { display: flex; justify-content: flex-end; gap: 10px; }
    .ti-dlg-warn { background: var(--err); border-color: var(--err); }
    .sla-tmsg { font-size: 12px; color: var(--muted); min-height: 14px; }
    .sla-tmsg.err { color: var(--err); }

    /* ---- AI reply suggestions in the team inbox ---- */
    .ti-reply-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .ti-ai-btn { background: linear-gradient(135deg, #f3ecff, #e6efff); border: 1px solid #cdbdf5; color: #4b2fa8; font-weight: 600; }
    .ti-ai-btn:hover:not(:disabled) { background: linear-gradient(135deg, #ebe0ff, #d9e6ff); }
    .ti-ai-btn:disabled { opacity: .6; cursor: wait; }
    .ti-ai-panel { border: 1px solid #d9ccf7; background: #faf8ff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
    .ti-ai-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
    .ti-ai-head b { color: #4b2fa8; font-size: 14px; }
    .ti-ai-hint { font-size: 12px; color: var(--muted); flex: 1 1 auto; }
    .ti-ai-head .ti-link { margin-left: auto; }
    .ti-ai-sum, .ti-ai-miss { font-size: 13px; line-height: 1.5; color: var(--text); }
    .ti-ai-sum span, .ti-ai-miss span { display: block; font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
    .ti-ai-miss ul { margin: 0; padding-left: 18px; }
    .ti-ai-caution { font-size: 13px; line-height: 1.5; background: #fff4db; color: #7a4d00; border-radius: 8px; padding: 8px 10px; }
    .ti-ai-list { display: flex; flex-direction: column; gap: 10px; }
    .ti-ai-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
    .ti-ai-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
    .ti-ai-card-head span { display: flex; align-items: center; gap: 12px; }
    .ti-ai-use { padding: 5px 12px; font-size: 12.5px; }
    .ti-ai-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; color: var(--text); }
    .ti-ai-foot { display: flex; justify-content: flex-end; }
    .ti-ai-err { font-size: 13px; color: var(--err); }
    .ti-ai-load { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
    .ti-ai-dots { display: inline-flex; gap: 4px; }
    .ti-ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: #8b6fe0; animation: tiAiBlink 1s infinite ease-in-out; }
    .ti-ai-dots i:nth-child(2) { animation-delay: .15s; }
    .ti-ai-dots i:nth-child(3) { animation-delay: .3s; }
    @keyframes tiAiBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
    .ti-ai-log { display: flex; flex-direction: column; gap: 8px; }
    .ti-ai-msg { max-width: 92%; font-size: 13.5px; line-height: 1.5; border-radius: 12px; padding: 8px 12px; white-space: pre-wrap; }
    .ti-ai-msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
    .ti-ai-msg.ai { align-self: stretch; max-width: 100%; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; display: flex; flex-direction: column; gap: 8px; white-space: normal; }
    .ti-ai-msg.ai.err { color: var(--err); }
    .ti-ai-msg .ti-ai-card { border-color: #d9ccf7; background: #faf8ff; }
    .ti-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
    .ti-ai-chip { border: 1px solid #d9ccf7; background: #fff; color: #4b2fa8; border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12.5px; cursor: pointer; }
    .ti-ai-chip:hover { background: #f3ecff; }
    .ti-ai-ask { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: -12px; background: #faf8ff; padding-top: 4px; }
    .ti-ai-ask textarea { flex: 1 1 auto; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13.5px; line-height: 1.4; max-height: 120px; background: #fff; }
    .ti-ai-ask textarea:focus { outline: 2px solid #d9ccf7; border-color: #8b6fe0; }
    .ti-ai-ask .btn { flex: 0 0 auto; }

    /* ---- reply approval: the draft bar above the reply box, the row tag ---- */
    #tiDraftBar { background: #fff8e6; border: 1px solid #f0d58a; border-radius: 12px; padding: 10px 12px; margin: 0 0 8px; display: flex; flex-direction: column; gap: 8px; }
    #tiDraftBar[style*="display: none"] { display: none !important; }
    .ti-draft-head { font-size: 13.5px; color: var(--text); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
    .ti-draft-bad { color: var(--err); }
    .ti-draft-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; max-height: 140px; overflow-y: auto; color: var(--text); }
    .ti-draft-actions { display: flex; flex-wrap: wrap; gap: 8px; }
    .ti-draft-btn { padding: 5px 12px; font-size: 12.5px; }
    .ib-tag.ti-approval { background: #fff4db; color: #7a4d00; font-weight: 600; }

/* Admin > Topic routing (topic-routing.js) */
.tr-rows { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.tr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; background: #fff; }
.tr-lab { font-size: 13px; color: var(--muted, #6b7280); }
.tr-row select { min-width: 190px; padding: 7px 10px; border: 1px solid var(--border, #d1d5db); border-radius: 6px; font-size: 13.5px; background: #fff; }
.tr-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.tr-msg { font-size: 13px; color: var(--muted, #6b7280); }
.tr-msg.err { color: #b91c1c; }
.tr-foot { margin-top: 10px; font-size: 12.5px; }
.tr-h { margin: 22px 0 8px; font-size: 14px; }
.tr-log { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

/* ---- the reply area never grows past the conversation column: the writing area scrolls, the draft bar scrolls, and the buttons (Attach, Discard, AI, Send) stay in view ---- */
.ib-conv { overflow: hidden; }
.ti-reply { flex: 0 1 auto; min-height: 0; max-height: min(48vh, 520px); display: flex; flex-direction: column; overflow: hidden; }
.ti-reply > .ti-ai-panel { flex: 0 1 auto; min-height: 0; max-height: 36vh; overflow-y: auto; }
.ti-reply > .ti-reply-btns, .ti-reply > .ti-reply-form { flex-shrink: 0; }
.ti-reply > .ti-reply-form { flex: 1 1 auto; flex-shrink: 1; min-height: 0; max-height: none; overflow-y: auto; }
.ti-reply-foot { position: sticky; bottom: 0; z-index: 3; margin: 0 -12px -10px; padding: 6px 12px 10px; background: #fff; border-top: 1px solid var(--row-border); }
#tiDraftBar { flex: 0 0 auto; max-height: min(18vh, 200px); overflow-y: auto; }
.ti-editor { min-height: 60px; }

/* ---- split a conversation (team-inbox.js: tiSplitStart ...) ---- */
.ti-split-bar { position: sticky; top: -16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: -16px -20px 12px; padding: 10px 20px; background: #eef4ff; border-bottom: 1px solid #c7d7fb; font-size: 13px; }
.ti-split-btns { display: inline-flex; gap: 8px; }
.ib-msg .ti-split-pick { display: flex; align-items: flex-start; padding-top: 6px; }
.ib-msg .ti-split-pick input { width: 17px; height: 17px; cursor: pointer; }
.ib-split-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 8px 12px; border: 1px dashed #b6c4e6; border-radius: 10px; background: #f6f8ff; font-size: 13px; color: var(--text); }
.ib-split-line .ib-split-ic { font-size: 15px; color: #3b5bdb; }
.ib-split-line .btn { margin-left: auto; }

/* ---- drag the top edge of the reply box to make the writing area taller / shorter (team-inbox.js tiAddGrip; remembered on this computer, double click = back to normal) ---- */
.ti-reply { position: relative; }
.ti-grip { position: absolute; top: 0; left: 0; right: 0; height: 12px; cursor: row-resize; z-index: 8; display: flex; align-items: flex-start; justify-content: center; }
.ti-grip::before { content: ''; width: 46px; height: 4px; margin-top: 3px; border-radius: 3px; background: var(--border); transition: background 0.15s ease; }
.ti-grip:hover::before, body.ti-dragging-y .ti-grip::before { background: var(--accent); }
body.ti-dragging-y { user-select: none; cursor: row-resize; }
body.ti-dragging-y iframe { pointer-events: none; }
.ti-reply:has(> #tiReplyForm[style*="display:none"]) > .ti-grip, .ti-reply:has(> #tiReplyForm[style*="display: none"]) > .ti-grip { display: none; }
.ti-reply.ti-sized { max-height: min(86vh, calc(var(--ti-ch) + 320px)); }
.ti-reply.ti-sized .ti-editor { min-height: var(--ti-ch); max-height: var(--ti-ch); }
.ti-reply.ti-sized .ti-chan-text { min-height: var(--ti-ch); max-height: var(--ti-ch); }

/* a phone call line in an SMS conversation (team-inbox.js tiChanCard): quieter than a text */
.tg-msg-bubble.ti-call { background: transparent; border: 1px dashed var(--border); color: var(--muted); font-size: 12.5px; box-shadow: none; }
.ti-chan-files a { color: var(--accent); font-weight: 600; text-decoration: none; margin-right: 10px; }
.ti-chan-files a:hover { text-decoration: underline; }

/* Rate Requests page: the rate request emails (public/js/request-emails.js) */
.rq-table { table-layout: fixed; width: 100%; }
.rq-table .rq-c-type { width: 120px; }
.rq-table .rq-c-from { width: 26%; }
.rq-table .rq-c-when { width: 170px; }
.rq-table .rq-c-status { width: 90px; }
.rq-table th, .rq-table td { vertical-align: middle; text-align: left; }
.rq-table td { padding-top: 12px; padding-bottom: 12px; overflow: hidden; }
.rq-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; line-height: 1.35; }
.rq-main.rq-clamp { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.rq-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.35; margin-top: 2px; }
.rq-type { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #e0e7ff; color: #3730a3; }
.rq-wait { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #fee2e2; color: #991b1b; }

/* Admin > Mailboxes & channels: the list of teams and the team panel (public/js/mailboxes.js) */
.mb-team-table th.mb-n, .mb-team-table td.mb-n { text-align: center; width: 130px; }
.mb-team-table td { vertical-align: middle; }
.mb-team-row { cursor: pointer; }
.mb-team-row:hover, .mb-team-row:focus { background: var(--hover, rgba(37, 99, 235, 0.06)); outline: none; }
.mb-changes { font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 6px; background: var(--bg-soft, #f1f5f9); }
.mb-sec { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.mb-sec-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.mb-sec-count { font-size: 12px; color: var(--muted); }
.mb-sec-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.mb-sec-search { flex: 1; min-width: 140px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; }
.mb-sec-tools .btn { padding: 5px 9px; font-size: 12px; }
.mb-sec-list { max-height: 260px; overflow-y: auto; border-top: 1px solid var(--border); }
.mb-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; cursor: pointer; border-bottom: 1px solid var(--border-soft, rgba(0, 0, 0, 0.05)); }
.mb-row-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mb-row-note { font-size: 11.5px; color: var(--muted-2, var(--muted)); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-gone { color: var(--err, #b91c1c); font-size: 11.5px; }

/* Admin > Mailboxes & channels: the "Assign" button of a team row and the window that shows what is assigned to a team */
.mb-assign-btn { padding: 6px 16px; font-size: 12.5px; font-weight: 600; border-radius: 8px; white-space: nowrap; }
.mbm-scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 1200; padding: 16px; animation: mbmFade .15s ease-out; }
.mbm { background: var(--card, #fff); color: inherit; width: min(700px, 100%); max-height: 88vh; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35); animation: mbmPop .18s ease-out; }
@keyframes mbmFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mbmPop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.mbm-head { display: flex; align-items: flex-start; gap: 16px; padding: 22px 24px 18px; background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(124, 58, 237, 0.06)); border-bottom: 1px solid var(--border); }
.mbm-avatar { flex: 0 0 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35); }
.mbm-head-text { flex: 1; min-width: 0; }
.mbm-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2, var(--muted)); }
.mbm-head h3 { margin: 2px 0 2px; font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; }
.mbm-total { font-size: 13px; color: var(--muted); }
.mbm-sums { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mbm-sum { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12.5px; background: var(--card, #fff); border: 1px solid var(--border); color: var(--muted); }
.mbm-sum svg { width: 14px; height: 14px; }
.mbm-sum b { color: inherit; font-weight: 700; }
.mbm-sum-email { color: #2563eb; } .mbm-sum-chat { color: #0891b2; } .mbm-sum-quo { color: #16a34a; } .mbm-sum-teams { color: #7c3aed; }
.mbm-x { border: 0; background: rgba(15, 23, 42, 0.06); width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.mbm-x:hover { background: rgba(15, 23, 42, 0.12); color: inherit; }
.mbm-body { overflow-y: auto; padding: 16px 24px 8px; display: flex; flex-direction: column; gap: 14px; background: var(--bg-soft, #f8fafc); }
.mbm-sec { background: var(--card, #fff); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px 6px; }
.mbm-sec-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft, rgba(0, 0, 0, 0.06)); }
.mbm-sec-head strong { flex: 1; font-size: 14px; }
.mbm-ico { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.mbm-ico-email { background: rgba(37, 99, 235, 0.12); color: #2563eb; } .mbm-ico-chat { background: rgba(8, 145, 178, 0.12); color: #0891b2; }
.mbm-ico-quo { background: rgba(22, 163, 74, 0.12); color: #16a34a; } .mbm-ico-teams { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.mbm-count { min-width: 26px; text-align: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg-soft, #f1f5f9); color: var(--muted); }
.mbm-list { list-style: none; margin: 0; padding: 0; }
.mbm-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 4px; font-size: 13.5px; border-bottom: 1px solid var(--border-soft, rgba(0, 0, 0, 0.05)); }
.mbm-item:last-child { border-bottom: 0; }
.mbm-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbm-sub { color: var(--muted); font-size: 12.5px; }
.mbm-none { padding: 12px 4px 10px; font-size: 12.5px; color: var(--muted-2, var(--muted)); }
.mbm-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--card, #fff); }
.mbm-foot .btn { padding: 8px 20px; border-radius: 9px; font-weight: 600; }
@media (max-width: 560px) { .mbm-item { flex-direction: column; align-items: flex-start; gap: 4px; } }

/* Inbox > Drafts — needs review: the draft under a conversation (public/js/team-inbox.js tiDraftLine) */
.ti-draftline { margin-top: 6px; padding: 6px 9px; border-radius: 8px; background: rgba(245, 158, 11, 0.12); border-left: 3px solid #f59e0b; font-size: 12px; line-height: 1.4; }
.ti-draftline-h { display: block; font-weight: 700; color: #92400e; }
.ti-draftline-p { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
