/* Fiber Command Center — Communications workspace.
   Phase 1 window shell. Scoped under .fcc-cw* so it cannot leak into the
   existing application styles. Matches the approved mockup. */

:root {
  --fcc-blue: #1d6fe0;
  --fcc-blue-dark: #0f4ea8;
  --fcc-blue-deep: #0b3c82;
  --fcc-red: #e5342a;
  --fcc-green: #22c55e;
  --fcc-surface: #ffffff;
  --fcc-surface-2: #f5f7fa;
  --fcc-line: #e3e8ef;
  --fcc-text: #111827;
  --fcc-text-2: #6b7280;
}

/* ---------- entry card ---------- */
.fcc-cw-entry {
  display: flex; align-items: center; gap: 18px;
  width: 100%; box-sizing: border-box;
  padding: 18px 22px; margin: 0 0 18px;
  border: 1px solid #cfe0f7; border-radius: 18px;
  background: linear-gradient(100deg, #eaf2fd 0%, #f4f9ff 55%, #e8f1fd 100%);
  box-shadow: 0 2px 10px rgba(16, 48, 94, 0.07);
  cursor: pointer; position: relative; overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease;
}
.fcc-cw-entry:hover { box-shadow: 0 6px 20px rgba(16, 48, 94, 0.14); transform: translateY(-1px); }
.fcc-cw-entry:focus-visible { outline: 3px solid var(--fcc-blue); outline-offset: 2px; }
.fcc-cw-entry-tile {
  flex: 0 0 auto; width: 58px; height: 58px; border-radius: 14px;
  background: var(--fcc-blue); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(29, 111, 224, .35);
}
.fcc-cw-entry-tile svg { width: 30px; height: 30px; }
.fcc-cw-entry-rule { flex: 0 0 auto; width: 2px; height: 44px; background: #c6d9f3; border-radius: 2px; }
.fcc-cw-entry-text { flex: 1 1 auto; min-width: 0; }
.fcc-cw-entry-title { font-size: 26px; font-weight: 700; color: #0d1b2a; line-height: 1.15; }
.fcc-cw-entry-sub { font-size: 15px; color: #52637a; margin-top: 2px; }
.fcc-cw-entry-art {
  position: absolute; right: 0; top: 0; bottom: 0; width: 230px;
  pointer-events: none; opacity: .9;
}
.fcc-cw-badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--fcc-red); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-grid; place-items: center; box-sizing: border-box;
}
.fcc-cw-entry-badge { position: absolute; top: 14px; right: 16px; z-index: 2; }

/* ---------- window ---------- */
.fcc-cw-window {
  position: fixed; z-index: 2147483000;
  display: flex; flex-direction: column;
  background: var(--fcc-surface);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(8, 25, 52, .38), 0 2px 8px rgba(8, 25, 52, .2);
  opacity: 0; transform: scale(.985);
  transition: opacity .16s ease, transform .16s ease;
  min-width: 360px; min-height: 320px;
}
.fcc-cw-window.is-open { opacity: 1; transform: scale(1); }
.fcc-cw-window.is-hidden { display: none; }
.fcc-cw-window.is-max { border-radius: 0; }
@media (prefers-reduced-motion: reduce) { .fcc-cw-window { transition: none; } }

.fcc-cw-titlebar {
  flex: 0 0 auto; height: 52px; display: flex; align-items: center; gap: 12px;
  padding: 0 8px 0 16px; color: #fff; user-select: none;
  background: linear-gradient(95deg, var(--fcc-blue-deep) 0%, var(--fcc-blue-dark) 45%, var(--fcc-blue) 100%);
  cursor: grab;
}
.fcc-cw-titlebar.is-dragging { cursor: grabbing; }
.fcc-cw-brandmark { width: 26px; height: 26px; flex: 0 0 auto; }
.fcc-cw-brand { font-size: 17px; font-weight: 650; white-space: nowrap; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fcc-cw-title-rule { width: 1px; height: 22px; background: rgba(255,255,255,.4); flex: 0 0 auto; }
.fcc-cw-title-mod { font-size: 16px; font-weight: 400; opacity: .95; white-space: nowrap; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fcc-cw-title-spacer { flex: 1 1 auto; min-width: 0; }
/* The window controls must never be squeezed off the edge. */
.fcc-cw-titlebar > .fcc-cw-iconbtn,
.fcc-cw-titlebar > .fcc-cw-presence { flex: 0 0 auto; }

.fcc-cw-presence {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 10px; border-radius: 8px;
  background: transparent; border: 0; color: #fff; cursor: pointer;
  font-size: 14px; white-space: nowrap;
}
.fcc-cw-presence:hover { background: rgba(255,255,255,.14); }
.fcc-cw-presence-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--fcc-green); flex: 0 0 auto; }
.fcc-cw-iconbtn {
  width: 36px; height: 32px; border: 0; background: transparent; color: #fff;
  border-radius: 8px; cursor: pointer; display: grid; place-items: center; position: relative;
}
.fcc-cw-iconbtn:hover { background: rgba(255,255,255,.14); }
.fcc-cw-iconbtn svg { width: 18px; height: 18px; }
/* The host application's global button/svg rules were darkening these icons
   to near-black against the blue bar. Force full-contrast white and give the
   controls a translucent chip so they read at a glance. */
.fcc-cw-titlebar .fcc-cw-iconbtn,
.fcc-cw-titlebar .fcc-cw-presence { color: #ffffff !important; }
.fcc-cw-titlebar .fcc-cw-iconbtn svg,
.fcc-cw-titlebar .fcc-cw-presence svg {
  color: #ffffff !important; stroke: #ffffff !important; fill: none !important;
  stroke-width: 2.1; opacity: 1;
}
.fcc-cw-titlebar .fcc-cw-iconbtn svg * { stroke: #ffffff !important; fill: none !important; }
.fcc-cw-titlebar .fcc-cw-winbtn {
  background: rgba(255,255,255,.16);
  margin-left: 6px;
}
.fcc-cw-titlebar .fcc-cw-winbtn:hover { background: rgba(255,255,255,.34); }
.fcc-cw-titlebar .fcc-cw-winbtn.is-close { background: rgba(255,255,255,.16); }
.fcc-cw-titlebar .fcc-cw-winbtn.is-close:hover { background: #e81123; }
.fcc-cw-titlebar .fcc-cw-iconbtn[title="Activity"] { background: rgba(255,255,255,.12); }
.fcc-cw-bell-badge { position: absolute; top: 1px; right: 2px; transform: scale(.8); transform-origin: top right; }
.fcc-cw-winbtn { width: 42px; height: 34px; }
.fcc-cw-winbtn.is-close:hover { background: #e81123; }

/* ---------- body ---------- */
.fcc-cw-body { flex: 1 1 auto; display: flex; min-height: 0; background: var(--fcc-surface); }

/* left rail */
.fcc-cw-rail {
  flex: 0 0 212px; display: flex; flex-direction: column;
  border-right: 1px solid var(--fcc-line); background: #fff;
  padding: 10px 10px 0; overflow: hidden; position: relative;
}
.fcc-cw-rail-list { overflow-y: auto; flex: 1 1 auto; }
.fcc-cw-navitem {
  display: flex; align-items: center; gap: 12px; width: 100%;
  height: 42px; padding: 0 12px; margin-bottom: 2px; border: 0;
  border-radius: 10px; background: transparent; cursor: pointer;
  font-size: 15px; color: #2b3647; text-align: left;
}
.fcc-cw-navitem svg { width: 19px; height: 19px; flex: 0 0 auto; color: #5a6b80; }
.fcc-cw-navitem:hover { background: #eef2f7; }
.fcc-cw-navitem.is-active { background: var(--fcc-blue); color: #fff; font-weight: 600; }
.fcc-cw-navitem.is-active svg { color: #fff; }
.fcc-cw-navitem-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcc-cw-navitem .fcc-cw-badge { background: var(--fcc-blue); }
.fcc-cw-navitem.is-active .fcc-cw-badge { background: #fff; color: var(--fcc-blue); }
.fcc-cw-rail-wave { flex: 0 0 auto; pointer-events: none; opacity: .55; margin: 0 -10px -1px; }

/* list column */
.fcc-cw-list {
  flex: 0 0 302px; display: flex; flex-direction: column;
  border-right: 1px solid var(--fcc-line); background: #fff; min-width: 0;
}
.fcc-cw-list-head { display: flex; align-items: center; gap: 6px; padding: 14px 14px 8px; }
.fcc-cw-list-title { font-size: 21px; font-weight: 700; flex: 1 1 auto; color: var(--fcc-text); }
.fcc-cw-list-head .fcc-cw-iconbtn { color: #5a6b80; }
.fcc-cw-list-head .fcc-cw-iconbtn:hover { background: #eef2f7; }
.fcc-cw-search { position: relative; padding: 0 14px 10px; }
.fcc-cw-search svg { position: absolute; left: 24px; top: 9px; width: 16px; height: 16px; color: #8b97a8; }
.fcc-cw-search input {
  width: 100%; box-sizing: border-box; height: 34px; padding: 0 10px 0 32px;
  border: 1px solid var(--fcc-line); border-radius: 8px; background: var(--fcc-surface-2);
  font-size: 14px; color: var(--fcc-text); outline: none;
}
.fcc-cw-search input:focus { border-color: var(--fcc-blue); background: #fff; }
.fcc-cw-chips { display: flex; gap: 7px; padding: 0 14px 10px; flex-wrap: wrap; }
.fcc-cw-chip {
  height: 27px; padding: 0 12px; border-radius: 999px; border: 0;
  background: #eef2f7; color: #41506a; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.fcc-cw-chip.is-active { background: var(--fcc-blue); color: #fff; font-weight: 600; }
.fcc-cw-rows { flex: 1 1 auto; overflow-y: auto; padding: 0 8px 10px; }
.fcc-cw-row {
  display: flex; gap: 10px; align-items: flex-start; width: 100%;
  padding: 9px 8px; border: 0; border-radius: 10px; background: transparent;
  cursor: pointer; text-align: left;
}
.fcc-cw-row:hover { background: #f2f6fb; }
.fcc-cw-row.is-active { background: #e4eefb; }
.fcc-cw-avatar {
  position: relative; flex: 0 0 auto;
  width: 38px; height: 38px; min-width: 38px; min-height: 38px;
  border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700;
  background: #7a8aa0;
}
/* Absolute fill: inside a grid with place-items:center a percentage-sized
   image resolves against the content-sized track, so every photo came out a
   different size. Pinning to the box guarantees one identical circle. */
.fcc-cw-avatar img {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  max-width: none; max-height: none;
  border-radius: 50%; object-fit: cover; object-position: center top;
  display: block;
}
.fcc-cw-avatar svg { width: 20px; height: 20px; }
/* Message avatars sit slightly larger; keep them equally uniform. */
.fcc-cw-msg .fcc-cw-avatar { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
.fcc-cw-pane-head .fcc-cw-avatar { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
.fcc-cw-row-main { flex: 1 1 auto; min-width: 0; }
.fcc-cw-row-top { display: flex; align-items: baseline; gap: 8px; }
.fcc-cw-row-name { flex: 1 1 auto; min-width: 0; font-size: 14.5px; font-weight: 600; color: var(--fcc-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcc-cw-row-time { flex: 0 0 auto; font-size: 12px; color: var(--fcc-text-2); }
.fcc-cw-row-bot { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.fcc-cw-row-prev { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--fcc-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcc-cw-row-unread { flex: 0 0 auto; background: var(--fcc-blue); }

/* conversation pane */
.fcc-cw-pane { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; background: #fff; }
.fcc-cw-pane-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 13px 16px 0; }
.fcc-cw-pane-id { flex: 1 1 auto; min-width: 0; }
.fcc-cw-pane-title { font-size: 19px; font-weight: 700; color: var(--fcc-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcc-cw-pane-sub { font-size: 13px; color: var(--fcc-text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcc-cw-pane-sub a { color: var(--fcc-blue); text-decoration: none; }
.fcc-cw-pane-sub a:hover { text-decoration: underline; }
.fcc-cw-pane-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.fcc-cw-pane-actions .fcc-cw-iconbtn { color: #41506a; }
.fcc-cw-pane-actions .fcc-cw-iconbtn:hover { background: #eef2f7; }
.fcc-cw-tabs { flex: 0 0 auto; display: flex; gap: 18px; padding: 8px 18px 0; border-bottom: 1px solid var(--fcc-line); }
.fcc-cw-tab {
  border: 0; background: transparent; cursor: pointer; padding: 6px 2px 9px;
  font-size: 14.5px; color: #41506a; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.fcc-cw-tab:hover { color: var(--fcc-blue); }
.fcc-cw-tab.is-active { color: var(--fcc-blue); font-weight: 650; border-bottom-color: var(--fcc-blue); }

.fcc-cw-msgs { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px; min-height: 0; }
.fcc-cw-msg { display: flex; gap: 11px; margin-bottom: 15px; }
.fcc-cw-msg-main { flex: 1 1 auto; min-width: 0; }
.fcc-cw-msg-top { display: flex; align-items: baseline; gap: 9px; margin-bottom: 3px; }
.fcc-cw-msg-name { font-size: 14.5px; font-weight: 650; color: var(--fcc-text); }
.fcc-cw-msg-time { font-size: 12px; color: var(--fcc-text-2); }
.fcc-cw-bubble {
  display: inline-block; max-width: 100%; box-sizing: border-box;
  padding: 9px 13px; border-radius: 10px; background: var(--fcc-surface-2);
  font-size: 14.5px; color: #1f2937; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap;
}
.fcc-cw-file {
  display: flex; align-items: center; gap: 11px; margin-top: 8px; max-width: 420px;
  padding: 9px 12px; border: 1px solid var(--fcc-line); border-radius: 10px; background: #fff;
}
.fcc-cw-file-ic { flex: 0 0 auto; width: 26px; height: 26px; color: #d93025; }
.fcc-cw-file-main { flex: 1 1 auto; min-width: 0; }
.fcc-cw-file-name { font-size: 13.5px; font-weight: 600; color: var(--fcc-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcc-cw-file-size { font-size: 12px; color: var(--fcc-text-2); }
.fcc-cw-reacts { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.fcc-cw-react {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; border: 1px solid var(--fcc-line); background: var(--fcc-surface-2);
  font-size: 12.5px; color: #374151; cursor: pointer;
}
.fcc-cw-react.is-mine { border-color: var(--fcc-blue); background: #e4eefb; color: var(--fcc-blue-dark); }

/* composer */
.fcc-cw-composer { flex: 0 0 auto; margin: 0 18px 16px; border: 1px solid var(--fcc-line); border-radius: 12px; background: #fff; }
.fcc-cw-fmt { display: flex; align-items: center; gap: 2px; padding: 5px 8px; border-bottom: 1px solid var(--fcc-line); flex-wrap: wrap; }
.fcc-cw-fmt .fcc-cw-iconbtn { width: 30px; height: 26px; color: #41506a; }
.fcc-cw-fmt .fcc-cw-iconbtn:hover { background: #eef2f7; }
.fcc-cw-fmt .fcc-cw-iconbtn svg { width: 15px; height: 15px; }
.fcc-cw-input {
  width: 100%; box-sizing: border-box; border: 0; outline: none; resize: none;
  padding: 11px 13px; font: inherit; font-size: 14.5px; color: var(--fcc-text);
  background: transparent; max-height: 160px; min-height: 42px; display: block;
}
.fcc-cw-comp-bot { display: flex; align-items: center; gap: 2px; padding: 5px 8px 7px; }
.fcc-cw-comp-bot .fcc-cw-iconbtn { width: 30px; height: 28px; color: #41506a; }
.fcc-cw-comp-bot .fcc-cw-iconbtn:hover { background: #eef2f7; }
.fcc-cw-send {
  margin-left: auto; width: 40px; height: 32px; border: 0; border-radius: 8px;
  background: var(--fcc-blue); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.fcc-cw-send:disabled { opacity: .45; cursor: default; }
.fcc-cw-send svg { width: 17px; height: 17px; }

/* generic states */
.fcc-cw-empty { display: grid; place-items: center; height: 100%; text-align: center; color: var(--fcc-text-2); padding: 30px; }
.fcc-cw-empty svg { width: 54px; height: 54px; color: #b9c4d2; margin-bottom: 12px; }
.fcc-cw-empty-title { font-size: 18px; font-weight: 650; color: #44536b; }
.fcc-cw-empty-sub { font-size: 14px; margin-top: 4px; }

/* resize handles */
.fcc-cw-rz { position: absolute; z-index: 5; }
.fcc-cw-rz-n { top: -3px; left: 10px; right: 10px; height: 7px; cursor: ns-resize; }
.fcc-cw-rz-s { bottom: -3px; left: 10px; right: 10px; height: 7px; cursor: ns-resize; }
.fcc-cw-rz-w { left: -3px; top: 10px; bottom: 10px; width: 7px; cursor: ew-resize; }
.fcc-cw-rz-e { right: -3px; top: 10px; bottom: 10px; width: 7px; cursor: ew-resize; }
.fcc-cw-rz-nw { top: -4px; left: -4px; width: 14px; height: 14px; cursor: nwse-resize; }
.fcc-cw-rz-ne { top: -4px; right: -4px; width: 14px; height: 14px; cursor: nesw-resize; }
.fcc-cw-rz-sw { bottom: -4px; left: -4px; width: 14px; height: 14px; cursor: nesw-resize; }
.fcc-cw-rz-se { bottom: -4px; right: -4px; width: 14px; height: 14px; cursor: nwse-resize; }
.fcc-cw-window.is-max .fcc-cw-rz { display: none; }

/* taskbar chip when minimized */
.fcc-cw-taskbar {
  position: fixed; left: 18px; bottom: 18px; z-index: 2147483000;
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px 0 12px;
  border-radius: 12px; border: 1px solid #cfe0f7; background: #fff; cursor: pointer;
  box-shadow: 0 10px 28px rgba(8, 25, 52, .22); color: var(--fcc-text); font-size: 14.5px; font-weight: 600;
}
.fcc-cw-taskbar svg { width: 20px; height: 20px; color: var(--fcc-blue); }
.fcc-cw-taskbar .fcc-cw-badge { background: var(--fcc-red); }
.fcc-cw-live {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 999px; background: #fdecea; color: #b3261e; font-size: 12.5px; font-weight: 650;
}
.fcc-cw-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5342a; animation: fcc-cw-pulse 1.4s ease-in-out infinite; }
@keyframes fcc-cw-pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .fcc-cw-live-dot { animation: none; } }

/* close confirmation */
.fcc-cw-ask { position: absolute; inset: 0; background: rgba(9, 24, 48, .55); display: grid; place-items: center; z-index: 20; }
.fcc-cw-ask-card { width: min(420px, calc(100% - 40px)); background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 18px 50px rgba(0,0,0,.3); }
.fcc-cw-ask-title { font-size: 17px; font-weight: 700; color: var(--fcc-text); }
.fcc-cw-ask-body { font-size: 14px; color: var(--fcc-text-2); margin: 8px 0 18px; line-height: 1.5; }
.fcc-cw-ask-row { display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; }
.fcc-cw-btn { height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--fcc-line); background: #fff; color: var(--fcc-text); font-size: 14px; cursor: pointer; }
.fcc-cw-btn.is-primary { background: var(--fcc-blue); border-color: var(--fcc-blue); color: #fff; font-weight: 600; }
.fcc-cw-btn.is-danger { background: #d93025; border-color: #d93025; color: #fff; font-weight: 600; }

/* ---------- wired controls: menus, pickers, toasts ---------- */
.fcc-cw-menu-item.is-danger { color: #c0291f; }
.fcc-cw-menu-item.is-disabled { opacity: .5; cursor: default; }
.fcc-cw-menu-note { margin-left: auto; font-size: 12px; color: var(--fcc-text-2); }

.fcc-cw-emoji { display: grid; grid-template-columns: repeat(5, 36px); gap: 2px; min-width: 0; padding: 8px; }
.fcc-cw-emoji-btn {
  width: 36px; height: 34px; border: 0; background: transparent; border-radius: 8px;
  cursor: pointer; font-size: 19px; line-height: 1;
}
.fcc-cw-emoji-btn:hover { background: #eef2f7; }

.fcc-cw-modal {
  position: absolute; inset: 0; z-index: 30; background: rgba(9, 24, 48, .5);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.fcc-cw-modal-card {
  width: min(460px, 100%); max-height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--fcc-surface); border-radius: 14px;
  box-shadow: 0 20px 56px rgba(0,0,0,.34);
}
.fcc-cw-modal-head { padding: 16px 18px 6px; }
.fcc-cw-modal-title { font-size: 18px; font-weight: 700; color: var(--fcc-text); }
.fcc-cw-modal-sub { font-size: 13.5px; color: var(--fcc-text-2); margin-top: 3px; padding: 0 18px; }
.fcc-cw-modal-head .fcc-cw-modal-sub { padding: 0; }
.fcc-cw-modal-card .fcc-cw-search { padding: 10px 18px; }
.fcc-cw-modal-card .fcc-cw-search svg { left: 28px; top: 19px; }

.fcc-cw-picker-list { flex: 1 1 auto; overflow-y: auto; padding: 2px 10px 6px; min-height: 90px; max-height: 50vh; }
.fcc-cw-picker-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 8px; border: 0; border-radius: 10px; background: transparent;
  cursor: pointer; text-align: left;
}
.fcc-cw-picker-row:hover { background: #f2f6fb; }
.fcc-cw-picker-row.is-chosen { background: #e4eefb; }
.fcc-cw-tick { margin-left: auto; color: var(--fcc-blue); font-weight: 700; width: 18px; text-align: center; }

.fcc-cw-modal-foot {
  display: flex; align-items: center; gap: 9px; justify-content: flex-end;
  padding: 12px 18px 16px; border-top: 1px solid var(--fcc-line);
}
.fcc-cw-modal-count { margin-right: auto; font-size: 13px; color: var(--fcc-text-2); }

.fcc-cw-toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 22px; z-index: 40; max-width: 86%;
  padding: 10px 16px; border-radius: 10px;
  background: rgba(17, 24, 39, .94); color: #fff; font-size: 13.5px;
  box-shadow: 0 10px 28px rgba(0,0,0,.3);
}
.fcc-cw-iconbtn.is-disabled { opacity: .45; }

@media (max-width: 760px) {
  .fcc-cw-modal { padding: 10px; align-items: flex-end; }
  .fcc-cw-modal-card { width: 100%; border-radius: 14px 14px 0 0; max-height: 86%; }
  .fcc-cw-picker-list { max-height: 46vh; }
  .fcc-cw-toast { bottom: 76px; }
}

/* ---------- calling (Phase 3) ---------- */
.fcc-cw-call {
  position: absolute; inset: 52px 0 0 0; z-index: 28;
  display: flex; flex-direction: column;
  background: #0d1623; color: #fff;
}
.fcc-cw-call-head { flex: 0 0 auto; padding: 14px 18px 6px; }
.fcc-cw-call-title { font-size: 17px; font-weight: 700; }
.fcc-cw-call-sub { font-size: 13px; opacity: .72; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fcc-cw-call-grid {
  flex: 1 1 auto; min-height: 0; display: grid; gap: 8px; padding: 10px 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-content: center;
}
.fcc-cw-tile {
  position: relative; background: #16222f; border-radius: 12px; overflow: hidden;
  min-height: 150px; display: grid; place-items: center;
}
.fcc-cw-tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #16222f; }
.fcc-cw-tile.is-waiting { color: #9fb0c4; font-size: 14.5px; }
.fcc-cw-tile-name {
  position: absolute; left: 10px; bottom: 8px; z-index: 2;
  padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.55);
  font-size: 12.5px; max-width: calc(100% - 20px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fcc-cw-tile.is-waiting .fcc-cw-tile-name { position: static; background: transparent; }

.fcc-cw-pip {
  position: absolute; right: 16px; top: 70px; width: 132px; height: 96px;
  border-radius: 10px; overflow: hidden; z-index: 3;
  border: 2px solid rgba(255,255,255,.35); box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.fcc-cw-pip video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }

.fcc-cw-callbar {
  flex: 0 0 auto; display: flex; justify-content: center; gap: 12px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.fcc-cw-callctl {
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center;
}
.fcc-cw-callctl svg { width: 22px; height: 22px; }
.fcc-cw-callctl:hover { background: rgba(255,255,255,.24); }
.fcc-cw-callctl.is-on { background: #fff; color: #16222f; }
.fcc-cw-callctl.is-danger { background: #d93025; }
.fcc-cw-callctl.is-danger:hover { background: #ef4337; }
.fcc-cw-callctl.is-danger svg { transform: rotate(135deg); }

/* The host application's global button/svg rules were rendering these icons
   near-black against the dark call surface, making them invisible. Force full
   contrast, exactly as the title-bar controls had to be forced. */
.fcc-cw-call .fcc-cw-callctl,
.fcc-cw-call .fcc-cw-callctl svg { color: #ffffff !important; stroke: #ffffff !important; fill: none !important; }
.fcc-cw-call .fcc-cw-callctl svg * { stroke: #ffffff !important; fill: none !important; }
.fcc-cw-call .fcc-cw-callctl svg { stroke-width: 2.1; opacity: 1; }
/* The host app's button styling was squaring these off - force the circle. */
.fcc-cw-call .fcc-cw-callctl {
  border-radius: 50% !important;
  width: 52px !important; height: 52px !important;
  padding: 0 !important; border: 0 !important;
  flex: 0 0 auto;
}
.fcc-cw-call .fcc-cw-callctl svg { width: 22px !important; height: 22px !important; }
/* Handset tilted down, the universal hang-up gesture. */
.fcc-cw-call .fcc-cw-callctl.is-danger svg { transform: rotate(135deg); transform-origin: 50% 50%; }
@media (max-width: 760px) {
  .fcc-cw-call .fcc-cw-callctl { width: 58px !important; height: 58px !important; }
}
/* Active (toggled-on) controls invert to dark-on-white. */
.fcc-cw-call .fcc-cw-callctl.is-on,
.fcc-cw-call .fcc-cw-callctl.is-on svg { color: #16222f !important; stroke: #16222f !important; }
.fcc-cw-call .fcc-cw-callctl.is-on svg * { stroke: #16222f !important; }
/* Text on the dark call surface must stay light too. */
.fcc-cw-call, .fcc-cw-call .fcc-cw-call-title, .fcc-cw-call .fcc-cw-tile-name,
.fcc-cw-call .fcc-cw-ring-title { color: #ffffff !important; }
.fcc-cw-call .fcc-cw-call-sub, .fcc-cw-call .fcc-cw-ring-sub { color: rgba(255,255,255,.78) !important; }

.fcc-cw-call-error {
  margin: auto; width: min(420px, calc(100% - 36px));
  background: #16222f; border-radius: 14px; padding: 20px; text-align: center;
  box-shadow: 0 16px 44px rgba(0,0,0,.42);
}
.fcc-cw-call-error-title { font-size: 17px; font-weight: 700; margin-bottom: 7px; }
.fcc-cw-call-error-body { font-size: 14px; opacity: .82; line-height: 1.5; margin-bottom: 18px; }

.fcc-cw-ring {
  margin: auto; width: min(380px, calc(100% - 36px));
  background: #16222f; border-radius: 16px; padding: 22px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45); text-align: center;
}
.fcc-cw-ring-title { font-size: 20px; font-weight: 700; }
.fcc-cw-ring-sub { font-size: 14px; opacity: .75; margin: 6px 0 20px; }
.fcc-cw-ring-row { display: flex; gap: 10px; justify-content: center; }
.fcc-cw-ring-row .fcc-cw-btn { min-width: 120px; height: 42px; }

@media (max-width: 760px) {
  .fcc-cw-call-grid { grid-template-columns: 1fr; padding: 8px 10px; }
  .fcc-cw-pip { width: 104px; height: 76px; right: 12px; top: 64px; }
  .fcc-cw-callctl { width: 58px; height: 58px; }
}

/* ---------- scheduling: meetings + calendar (Phase 4) ---------- */
.fcc-cw-form { padding: 4px 18px 10px; overflow-y: auto; }
.fcc-cw-field { margin-bottom: 12px; }
.fcc-cw-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--fcc-text-2); margin-bottom: 5px; }
.fcc-cw-text {
  width: 100%; box-sizing: border-box; height: 38px; padding: 0 11px;
  border: 1px solid var(--fcc-line); border-radius: 9px; background: var(--fcc-surface-2);
  font: inherit; font-size: 14.5px; color: var(--fcc-text); outline: none;
}
.fcc-cw-text:focus { border-color: var(--fcc-blue); background: #fff; }
select.fcc-cw-text { height: 38px; }
.fcc-cw-row2 { display: flex; gap: 10px; }
.fcc-cw-row2 .fcc-cw-field { flex: 1 1 0; min-width: 0; }
.fcc-cw-form .fcc-cw-chips { padding: 0; gap: 6px; }
.fcc-cw-form .fcc-cw-btn { height: 30px; padding: 0 12px; font-size: 13px; }

.fcc-cw-detail-line { font-size: 14px; color: var(--fcc-text-2); margin-bottom: 14px; }
.fcc-cw-detail-head {
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--fcc-text-2); margin: 6px 0 8px;
}
.fcc-cw-detail-bar {
  flex: 0 0 auto; display: flex; gap: 9px; flex-wrap: wrap;
  padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--fcc-line);
}

.fcc-cw-cal-head { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 13px 16px 8px; }
.fcc-cw-cal-title { flex: 1 1 auto; font-size: 18px; font-weight: 700; color: var(--fcc-text); text-align: center; }
.fcc-cw-cal-head .fcc-cw-iconbtn { color: #41506a; }
.fcc-cw-cal-head .fcc-cw-iconbtn:hover { background: #eef2f7; }
.fcc-cw-cal-head .fcc-cw-btn { height: 30px; padding: 0 12px; font-size: 13px; }

.fcc-cw-cal-grid {
  flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 3px; padding: 0 12px 14px; align-content: start; overflow-y: auto;
}
.fcc-cw-cal-dow {
  text-align: center; font-size: 11.5px; font-weight: 700; color: var(--fcc-text-2);
  padding: 4px 0 6px; text-transform: uppercase; letter-spacing: .03em;
}
.fcc-cw-cal-day {
  position: relative; border: 0; background: transparent; cursor: pointer;
  border-radius: 9px; min-height: 48px; padding: 5px 2px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font: inherit; color: var(--fcc-text);
}
.fcc-cw-cal-day:hover { background: #eef2f7; }
.fcc-cw-cal-day.is-out { color: #b4bfcd; }
.fcc-cw-cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--fcc-blue); }
.fcc-cw-cal-day.is-sel { background: var(--fcc-blue); color: #fff; }
.fcc-cw-cal-day.is-sel .fcc-cw-cal-dot { background: #fff; }
.fcc-cw-cal-num { font-size: 14px; font-weight: 600; }
.fcc-cw-cal-dots { display: flex; gap: 3px; }
.fcc-cw-cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--fcc-blue); }
.fcc-cw-cal-dot.is-off { background: #9aa8bb; }
.fcc-cw-cal-dot.is-leave { background: #f0a030; }
.fcc-cw-cal-day.has-leave { box-shadow: inset 0 -2px 0 0 rgba(240,160,48,.55); }
.fcc-cw-cal-day.is-today.has-leave { box-shadow: inset 0 0 0 1.5px var(--fcc-blue), inset 0 -2px 0 0 rgba(240,160,48,.55); }
/* Empty days invite a click; all days show a subtle add affordance. */
.fcc-cw-cal-day::after {
  content: "+"; position: absolute; top: 2px; right: 5px;
  font-size: 12px; font-weight: 700; color: var(--fcc-blue);
  opacity: 0; transition: opacity .12s ease;
}
.fcc-cw-cal-day:hover::after { opacity: .75; }
.fcc-cw-cal-day.is-sel::after { color: #fff; }
.fcc-cw-dayadd { width: 100%; margin: 2px 0 10px; }

@media (max-width: 760px) {
  .fcc-cw-cal-day { min-height: 42px; }
  .fcc-cw-cal-grid { padding: 0 8px 12px; }
  .fcc-cw-detail-bar .fcc-cw-btn { flex: 1 1 auto; }
}

/* ---------- hosted module windows (Contractor Records) ---------- */
.pcs-records-window .fcc-cw-titlebar { cursor: grab; }
.pcs-records-body {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  /* Backdrop is copied from the app shell at runtime so the hosted page keeps
     its own contrast; this dark value is only the fallback. */
  background-color: #0f1b2b;
  -webkit-overflow-scrolling: touch;
}
.pcs-records-window { background: #0f1b2b; }
/* Deliberately NO layout overrides on the hosted page.
   The first attempt forced display/width/position/transform with !important,
   which destroyed a page that lays itself out with its own flex and grid
   structure. The window is only a scroll container now - the page keeps
   every one of its own styles. */
.pcs-records-body > .pcs-hosted { max-width: none; }
.pcs-records-taskbar { left: auto; right: 18px; }
@media (max-width: 760px) {
  .pcs-records-taskbar { right: 12px; left: auto; }
  .pcs-records-body { padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* ---------- personal contacts ---------- */
.fcc-cw-star {
  flex: 0 0 auto; width: 30px; height: 30px; line-height: 30px; text-align: center;
  font-size: 17px; color: #f0a030; border-radius: 8px; cursor: pointer; user-select: none;
}
.fcc-cw-star:hover { background: #eef2f7; }

/* ---------- whiteboards ---------- */
.fcc-cw-board-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 9px 16px; border-bottom: 1px solid var(--fcc-line);
}
.fcc-cw-swatch {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--fcc-line); padding: 0; flex: 0 0 auto;
}
.fcc-cw-swatch.is-on { border-color: var(--fcc-blue); box-shadow: 0 0 0 2px rgba(29,111,224,.25); }
.fcc-cw-board-wrap {
  flex: 1 1 auto; min-height: 0; position: relative;
  background: #ffffff;
  background-image: radial-gradient(#dde5ef 1px, transparent 1px);
  background-size: 22px 22px;
  overflow: hidden;
}
.fcc-cw-board-canvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; display: block; }

/* ---------- contractor records viewer ---------- */
.pcs-rv-window .fcc-cw-list { flex: 0 0 320px; }
.pcs-rv-field {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 7px 0; border-bottom: 1px solid var(--fcc-line);
}
.pcs-rv-field:last-child { border-bottom: 0; }
.pcs-rv-k {
  flex: 0 0 170px; font-size: 13px; color: var(--fcc-text-2);
  font-weight: 600; line-height: 1.45;
}
.pcs-rv-v {
  flex: 1 1 auto; min-width: 0; font-size: 14px; color: var(--fcc-text);
  line-height: 1.45; overflow-wrap: anywhere;
}
.pcs-rv-taskbar { left: auto; right: 18px; }
@media (max-width: 760px) {
  .pcs-rv-window .fcc-cw-list { flex: 1 1 auto; }
  .pcs-rv-field { flex-direction: column; gap: 2px; padding: 6px 0; }
  .pcs-rv-k { flex: none; font-size: 12px; }
  .pcs-rv-taskbar { right: 12px; }
}

/* ---------- app-wide control sizing fixes ---------- */
/* Lead checkboxes had no explicit size, so they fell back to the browser
   default and rendered oversized (noticeably so on mobile). Match the
   application's standard 15px control. */
.lead-toggle input[type="checkbox"],
.lead-toggle input {
  flex: 0 0 auto;
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;
  margin: 0;
  padding: 0;
  transform: none !important;
  zoom: 1 !important;
  cursor: pointer;
}

/* ---------- settings & integrations ---------- */
.pcs-set-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--fcc-line);
}
.pcs-set-row:last-child { border-bottom: 0; }
.pcs-set-text { flex: 1 1 auto; min-width: 0; }
.pcs-set-label { font-size: 14.5px; font-weight: 600; color: var(--fcc-text); }
.pcs-set-hint { font-size: 12.5px; color: var(--fcc-text-2); margin-top: 2px; line-height: 1.45; }
.pcs-set-ctl { flex: 0 0 auto; width: auto; min-width: 190px; }
.pcs-set-row .fcc-cw-btn { flex: 0 0 auto; }
.pcs-pill {
  flex: 0 0 auto; padding: 3px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
}
.pcs-pill.is-ok { background: #e4f6ec; color: #0b7a3b; }
.pcs-pill.is-off { background: #f1f3f6; color: #6b7280; }
.pcs-pill.is-checking { background: #eef2f7; color: #8b97a8; }
/* explicit theme overrides so the Appearance setting actually applies */
.fcc-cw-window.fcc-cw-theme-dark {
  --fcc-surface: #151b24; --fcc-surface-2: #1e2733; --fcc-line: #2b3645;
  --fcc-text: #e8edf4; --fcc-text-2: #9aa8bb;
}
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-rail,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-list,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-pane,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-composer { background: var(--fcc-surface); }
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-navitem { color: #cdd7e4; }
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-row:hover,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-navitem:hover { background: #222c3a; }
@media (max-width: 760px) {
  .pcs-set-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .pcs-set-ctl { min-width: 0; width: 100%; }
}

/* ---------- dark mode: elements with hard-coded light colours ----------
   The theme variables alone were not enough - plenty of rules carry literal
   light values, which left dark text on dark surfaces. One is-dark class is
   applied by the module so these need stating only once. */
.fcc-cw-window.fcc-cw-dark {
  --fcc-surface: #151b24; --fcc-surface-2: #1e2733; --fcc-line: #2b3645;
  --fcc-text: #e8edf4; --fcc-text-2: #9aa8bb;
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-rail,
.fcc-cw-window.fcc-cw-dark .fcc-cw-list,
.fcc-cw-window.fcc-cw-dark .fcc-cw-pane,
.fcc-cw-window.fcc-cw-dark .fcc-cw-composer,
.fcc-cw-window.fcc-cw-dark .fcc-cw-file,
.fcc-cw-window.fcc-cw-dark .fcc-cw-menu { background: var(--fcc-surface); }
.fcc-cw-window.fcc-cw-dark { background: var(--fcc-surface); }

/* text that was pinned to dark greys */
.fcc-cw-window.fcc-cw-dark .fcc-cw-bubble { background: var(--fcc-surface-2); color: var(--fcc-text); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-navitem,
.fcc-cw-window.fcc-cw-dark .fcc-cw-tab,
.fcc-cw-window.fcc-cw-dark .fcc-cw-chip,
.fcc-cw-window.fcc-cw-dark .fcc-cw-react,
.fcc-cw-window.fcc-cw-dark .fcc-cw-empty-title,
.fcc-cw-window.fcc-cw-dark .fcc-cw-menu-item,
.fcc-cw-window.fcc-cw-dark .fcc-cw-row-name,
.fcc-cw-window.fcc-cw-dark .fcc-cw-msg-name,
.fcc-cw-window.fcc-cw-dark .fcc-cw-pane-title,
.fcc-cw-window.fcc-cw-dark .fcc-cw-list-title,
.fcc-cw-window.fcc-cw-dark .fcc-cw-modal-title,
.fcc-cw-window.fcc-cw-dark .fcc-cw-cal-title,
.fcc-cw-window.fcc-cw-dark .fcc-cw-cal-num,
.fcc-cw-window.fcc-cw-dark .fcc-cw-file-name,
.fcc-cw-window.fcc-cw-dark .pcs-set-label,
.fcc-cw-window.fcc-cw-dark .pcs-rv-v { color: var(--fcc-text); }

/* icon buttons that were slate-on-white */
.fcc-cw-window.fcc-cw-dark .fcc-cw-list-head .fcc-cw-iconbtn,
.fcc-cw-window.fcc-cw-dark .fcc-cw-pane-actions .fcc-cw-iconbtn,
.fcc-cw-window.fcc-cw-dark .fcc-cw-fmt .fcc-cw-iconbtn,
.fcc-cw-window.fcc-cw-dark .fcc-cw-comp-bot .fcc-cw-iconbtn,
.fcc-cw-window.fcc-cw-dark .fcc-cw-cal-head .fcc-cw-iconbtn { color: #cdd7e4; }

/* surfaces, hovers and controls */
.fcc-cw-window.fcc-cw-dark .fcc-cw-chip,
.fcc-cw-window.fcc-cw-dark .fcc-cw-react,
.fcc-cw-window.fcc-cw-dark .pcs-pill.is-off { background: #222c3a; border-color: var(--fcc-line); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-chip.is-active { background: var(--fcc-blue); color: #fff; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-row:hover,
.fcc-cw-window.fcc-cw-dark .fcc-cw-navitem:hover,
.fcc-cw-window.fcc-cw-dark .fcc-cw-picker-row:hover,
.fcc-cw-window.fcc-cw-dark .fcc-cw-menu-item:hover,
.fcc-cw-window.fcc-cw-dark .fcc-cw-cal-day:hover,
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-btn:hover,
.fcc-cw-window.fcc-cw-dark .fcc-cw-star:hover,
.fcc-cw-window.fcc-cw-dark .fcc-cw-list-head .fcc-cw-iconbtn:hover,
.fcc-cw-window.fcc-cw-dark .fcc-cw-pane-actions .fcc-cw-iconbtn:hover { background: #222c3a; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-row.is-active,
.fcc-cw-window.fcc-cw-dark .fcc-cw-picker-row.is-chosen { background: #24374f; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-btn {
  background: var(--fcc-surface-2); color: var(--fcc-text); border-color: var(--fcc-line);
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-btn.is-primary { background: var(--fcc-blue); color: #fff; border-color: var(--fcc-blue); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-btn.is-danger { background: #d93025; color: #fff; border-color: #d93025; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-search input,
.fcc-cw-window.fcc-cw-dark .fcc-cw-text,
.fcc-cw-window.fcc-cw-dark .fcc-cw-input {
  background: var(--fcc-surface-2); color: var(--fcc-text); border-color: var(--fcc-line);
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-search input:focus,
.fcc-cw-window.fcc-cw-dark .fcc-cw-text:focus { background: #273243; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-input::placeholder,
.fcc-cw-window.fcc-cw-dark .fcc-cw-search input::placeholder { color: var(--fcc-text-2); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-cal-day.is-out { color: #5b6878; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-rail-wave path { fill: #1b2634; }
/* the whiteboard stays a white board on purpose - it is paper */

/* ---------- dark mode: final text contrast guarantee ----------
   Covers every way dark can be active - explicit .fcc-cw-dark, the legacy
   .fcc-cw-theme-dark class, and .fcc-cw-theme-auto on a dark device - and
   uses !important because the base rules carry literal light-mode colours
   that otherwise win on load order. */
.fcc-cw-window.fcc-cw-dark .fcc-cw-navitem,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-navitem {
  color: #dbe4ef !important;
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-navitem svg,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-navitem svg {
  color: #9fb0c4 !important; stroke: #9fb0c4 !important;
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-navitem.is-active,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-navitem.is-active { color: #ffffff !important; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-navitem.is-active svg,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-navitem.is-active svg {
  color: #ffffff !important; stroke: #ffffff !important;
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-chip,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-chip {
  color: #dbe4ef !important; background: #222c3a !important;
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-chip.is-active,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-chip.is-active {
  color: #ffffff !important; background: var(--fcc-blue) !important;
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-tab,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-tab { color: #b9c6d6 !important; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-tab.is-active,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-tab.is-active { color: #7ab6ff !important; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-empty-title,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-empty-title { color: #e8edf4 !important; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-empty-sub,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-empty-sub,
.fcc-cw-window.fcc-cw-dark .fcc-cw-row-prev,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-row-prev,
.fcc-cw-window.fcc-cw-dark .fcc-cw-row-time,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-row-time,
.fcc-cw-window.fcc-cw-dark .fcc-cw-pane-sub,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-pane-sub,
.fcc-cw-window.fcc-cw-dark .pcs-set-hint,
.fcc-cw-window.fcc-cw-theme-dark .pcs-set-hint,
.fcc-cw-window.fcc-cw-dark .fcc-cw-detail-head,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-detail-head,
.fcc-cw-window.fcc-cw-dark .pcs-rv-k,
.fcc-cw-window.fcc-cw-theme-dark .pcs-rv-k { color: #9fb0c4 !important; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-empty svg,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-empty svg { color: #5d6e82 !important; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-row-name,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-row-name,
.fcc-cw-window.fcc-cw-dark .fcc-cw-list-title,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-list-title,
.fcc-cw-window.fcc-cw-dark .fcc-cw-pane-title,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-pane-title,
.fcc-cw-window.fcc-cw-dark .fcc-cw-msg-name,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-msg-name,
.fcc-cw-window.fcc-cw-dark .fcc-cw-bubble,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-bubble,
.fcc-cw-window.fcc-cw-dark .pcs-set-label,
.fcc-cw-window.fcc-cw-theme-dark .pcs-set-label,
.fcc-cw-window.fcc-cw-dark .pcs-rv-v,
.fcc-cw-window.fcc-cw-theme-dark .pcs-rv-v,
.fcc-cw-window.fcc-cw-dark .fcc-cw-cal-num,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-cal-num,
.fcc-cw-window.fcc-cw-dark .fcc-cw-modal-title,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-modal-title { color: #e8edf4 !important; }
/* same guarantees when the device is dark and the theme is left on auto */
@media (prefers-color-scheme: dark) {
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-navitem { color: #dbe4ef !important; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-navitem svg { color: #9fb0c4 !important; stroke: #9fb0c4 !important; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-navitem.is-active,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-navitem.is-active svg { color: #ffffff !important; stroke: #ffffff !important; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-chip { color: #dbe4ef !important; background: #222c3a !important; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-chip.is-active { color: #fff !important; background: var(--fcc-blue) !important; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-tab { color: #b9c6d6 !important; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-empty-title,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-row-name,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-list-title,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-pane-title,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-bubble { color: #e8edf4 !important; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-empty-sub,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-row-prev,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-detail-head { color: #9fb0c4 !important; }
}

/* status menu */
.fcc-cw-menu {
  position: fixed; z-index: 2147483100; min-width: 230px; padding: 6px;
  background: #fff; border: 1px solid var(--fcc-line); border-radius: 12px;
  box-shadow: 0 16px 44px rgba(8, 25, 52, .26);
}
.fcc-cw-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 14.5px; color: var(--fcc-text); text-align: left; }
.fcc-cw-menu-item:hover { background: #eef2f7; }
.fcc-cw-menu-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.fcc-cw-menu-sep { height: 1px; background: var(--fcc-line); margin: 5px 4px; }

/* mobile bottom navigation */
.fcc-cw-botnav { display: none; }
.fcc-cw-scrim { display: none; }
@media (max-width: 760px) {
  .fcc-cw-botnav {
    display: flex; flex: 0 0 auto; align-items: stretch;
    border-top: 1px solid var(--fcc-line); background: #fff;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .fcc-cw-botnav-item {
    flex: 1 1 0; min-width: 0; border: 0; background: transparent; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 7px 2px 8px; color: #5a6b80; font-size: 11px; position: relative;
  }
  .fcc-cw-botnav-item svg { width: 21px; height: 21px; }
  .fcc-cw-botnav-item.is-active { color: var(--fcc-blue); font-weight: 650; }
  .fcc-cw-botnav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .fcc-cw-botnav-item .fcc-cw-badge { position: absolute; top: 3px; right: 50%; margin-right: -22px; transform: scale(.78); }
  .fcc-cw-scrim { display: block; position: absolute; inset: 52px 0 0 0; background: rgba(8,20,40,.42); z-index: 7; }
  .fcc-cw-window:not(.is-rail-open) .fcc-cw-scrim { display: none; }
  .fcc-cw-rail { width: 250px; }
}

/* mobile */
@media (max-width: 760px) {
  .fcc-cw-window { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }
  .fcc-cw-rz { display: none; }
  .fcc-cw-rail { position: absolute; left: 0; top: 52px; bottom: 0; z-index: 8; transform: translateX(-100%); transition: transform .18s ease; box-shadow: 8px 0 22px rgba(0,0,0,.18); }
  .fcc-cw-window.is-rail-open .fcc-cw-rail { transform: translateX(0); }
  .fcc-cw-list { flex: 1 1 auto; }
  .fcc-cw-window:not(.is-convo) .fcc-cw-pane { display: none; }
  .fcc-cw-window.is-convo .fcc-cw-list { display: none; }
  .fcc-cw-window.is-convo .fcc-cw-pane { display: flex; }
  .fcc-cw-entry-art { display: none; }
  .fcc-cw-entry-title { font-size: 21px; }
  .fcc-cw-mobile-only { display: inline-grid !important; }
  /* Narrow screens: drop the product wordmark so presence, notifications and
     the window controls always stay reachable. */
  .fcc-cw-titlebar { padding-left: 10px; gap: 6px; }
  .fcc-cw-brand, .fcc-cw-title-rule { display: none; }
  .fcc-cw-title-mod { font-size: 16px; font-weight: 650; }
  .fcc-cw-presence span:not(.fcc-cw-presence-dot) { display: none; }
  .fcc-cw-presence svg { display: none; }
  .fcc-cw-presence { padding: 0 6px; }
  .fcc-cw-winbtn { width: 38px; }
}
.fcc-cw-mobile-only { display: none !important; }

/* dark theme */
@media (prefers-color-scheme: dark) {
  .fcc-cw-window.fcc-cw-theme-auto {
    --fcc-surface: #151b24; --fcc-surface-2: #1e2733; --fcc-line: #2b3645;
    --fcc-text: #e8edf4; --fcc-text-2: #9aa8bb;
  }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-rail,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-list,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-pane,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-composer,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-file { background: var(--fcc-surface); }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-navitem { color: #cdd7e4; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-navitem:hover,
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-row:hover { background: #222c3a; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-row.is-active { background: #24374f; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-chip { background: #222c3a; color: #cdd7e4; }
  .fcc-cw-window.fcc-cw-theme-auto .fcc-cw-search input { background: #1e2733; color: #e8edf4; }
}

/* ---- composer attachments -------------------------------------------
   Chips for files staged on a message before it is sent. */
.fcc-cw-comp-atts {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px 10px 0;
}
.fcc-cw-att-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 220px; height: 26px; padding: 0 4px 0 9px;
  border: 1px solid var(--fcc-line); border-radius: 13px;
  background: #eef2f7; font-size: 12.5px;
  color: #0f1b2d;
}
.fcc-cw-att-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fcc-cw-att-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: 0 0 auto;
  border: 0; border-radius: 50%; background: transparent;
  cursor: pointer; font-size: 15px; line-height: 1; color: #52627a;
}
.fcc-cw-att-x:hover { background: rgba(8, 25, 52, .12); color: #0f1b2d; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-att-chip {
  background: var(--fcc-surface-2); color: var(--fcc-text);
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-att-x { color: var(--fcc-text-2); }

/* The overflow menu is now appended inside .fcc-cw-window so the dark rules
   above reach it. These explicit colours are a safety net: host global CSS
   outranks module CSS, and an unreadable menu is exactly the failure this
   is guarding against. */
.fcc-cw-menu { background: #ffffff; }
.fcc-cw-menu-item { color: #0f1b2d !important; }
.fcc-cw-menu-item:hover { background: #eef2f7; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-menu-item { color: var(--fcc-text) !important; }
.fcc-cw-menu-item.is-danger { color: #c0291f !important; }

/* ---- rich-text composer ---------------------------------------------
   The message box is a contenteditable surface now, so Bold, Italic and
   Underline apply real formatting instead of inserting markdown characters
   the sender had to look at. */
.fcc-cw-input[contenteditable] {
  min-height: 38px; max-height: 160px; overflow-y: auto;
  outline: none; white-space: pre-wrap; word-break: break-word;
}
.fcc-cw-input[contenteditable]:empty:before {
  content: attr(data-placeholder);
  color: #8b97a8; pointer-events: none; display: block;
}
.fcc-cw-input[contenteditable] ul,
.fcc-cw-input[contenteditable] ol { margin: 2px 0; padding-left: 22px; }
.fcc-cw-input[contenteditable] a { color: #1264a3; text-decoration: underline; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-input[contenteditable]:empty:before { color: var(--fcc-text-2); }

/* ---- emoji picker ---------------------------------------------------- */
.fcc-cw-emoji-pop { width: 322px; padding: 0; overflow: hidden; }
.fcc-cw-emoji-tabs {
  display: flex; gap: 2px; padding: 6px 8px;
  border-bottom: 1px solid var(--fcc-line); background: #f7f9fc;
}
.fcc-cw-emoji-tab {
  flex: 1 1 0; height: 28px; border: 0; border-radius: 6px;
  background: transparent; cursor: pointer; font-size: 16px; line-height: 1;
}
.fcc-cw-emoji-tab:hover { background: #e3e9f2; }
.fcc-cw-emoji-body { max-height: 268px; overflow-y: auto; padding: 6px 8px 10px; }
.fcc-cw-emoji-head {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #6b7a90; padding: 8px 2px 4px;
  position: sticky; top: 0; background: #fff;
}
.fcc-cw-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-tabs { background: var(--fcc-surface-2); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-tab:hover { background: rgba(255,255,255,.1); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-head { background: var(--fcc-surface); color: var(--fcc-text-2); }

/* ---- formatting inside sent messages --------------------------------- */
.fcc-cw-bubble strong { font-weight: 700; }
.fcc-cw-bubble em { font-style: italic; }
.fcc-cw-bubble u { text-decoration: underline; }
.fcc-cw-bubble s { text-decoration: line-through; opacity: .8; }
.fcc-cw-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em; background: rgba(8,25,52,.08);
  padding: 1px 5px; border-radius: 5px;
}
.fcc-cw-bubble a { color: #1264a3; text-decoration: underline; word-break: break-all; }
.fcc-cw-bubble ul, .fcc-cw-bubble ol { margin: 4px 0; padding-left: 22px; }
.fcc-cw-bubble li { margin: 1px 0; }
.fcc-cw-md-gap { height: 7px; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-bubble code { background: rgba(255,255,255,.14); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-bubble a { color: #6cb2f5; }

/* ---- HD colour emoji -------------------------------------------------
   Glyphs were falling back to whatever the operating system supplied, which
   is why they looked flat and differed between machines. Noto Color Emoji is
   self-hosted (dist/fonts, unicode-range subsetted) so every client renders
   the same crisp vector set. */
.fcc-cw-emoji-btn,
.fcc-cw-bubble,
.fcc-cw-input[contenteditable],
.fcc-cw-emoji-tab {
  font-family: var(--fcc-font, "Segoe UI", system-ui, -apple-system, sans-serif),
               "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

/* ---- picker shell, modelled on WhatsApp ------------------------------ */
.fcc-cw-emoji-pop { width: 352px; padding: 0; overflow: hidden; }
.fcc-cw-emoji-tabs {
  display: flex; gap: 0; padding: 0 6px;
  border-bottom: 1px solid var(--fcc-line); background: #fff;
}
.fcc-cw-emoji-tab {
  flex: 1 1 0; height: 40px; border: 0; background: transparent;
  cursor: pointer; font-size: 19px; line-height: 1; opacity: .55;
  border-bottom: 2.5px solid transparent; padding: 0;
}
.fcc-cw-emoji-tab:hover { opacity: .9; }
.fcc-cw-emoji-tab.is-active { opacity: 1; border-bottom-color: var(--fcc-accent, #1264a3); }
.fcc-cw-emoji-searchwrap { padding: 9px 10px 5px; background: #fff; }
.fcc-cw-emoji-search {
  width: 100%; height: 34px; box-sizing: border-box;
  border: 1px solid var(--fcc-line); border-radius: 18px;
  padding: 0 13px; font-size: 13.5px; outline: none;
  background: #f6f8fb; color: #0f1b2d;
}
.fcc-cw-emoji-search:focus { border-color: var(--fcc-accent, #1264a3); background: #fff; }
.fcc-cw-emoji-body { max-height: 300px; overflow-y: auto; padding: 2px 8px 10px; }
.fcc-cw-emoji-head {
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  color: #6b7a90; padding: 10px 3px 5px;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.fcc-cw-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0; }
.fcc-cw-emoji-btn {
  width: 100%; height: 38px; border: 0; background: transparent;
  cursor: pointer; font-size: 25px; line-height: 1; border-radius: 7px;
  padding: 0; display: flex; align-items: center; justify-content: center;
}
.fcc-cw-emoji-btn:hover { background: #eef2f7; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-tabs,
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-searchwrap { background: var(--fcc-surface); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-search {
  background: var(--fcc-surface-2); color: var(--fcc-text); border-color: var(--fcc-line);
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-head { background: var(--fcc-surface); color: var(--fcc-text-2); }
.fcc-cw-window.fcc-cw-dark .fcc-cw-emoji-btn:hover { background: rgba(255,255,255,.1); }

/* ---- active formatting state -------------------------------------------
   Bold, Italic and Underline now light up when the caret sits inside text
   carrying that format, matching Teams and Word. Driven by
   document.queryCommandState on selectionchange. */
.fcc-cw-fmt .fcc-cw-iconbtn.is-active {
  background: #dbe9f7 !important;
  color: #0b5c92 !important;
  box-shadow: inset 0 0 0 1px rgba(11, 92, 146, .28);
}
.fcc-cw-window.fcc-cw-dark .fcc-cw-fmt .fcc-cw-iconbtn.is-active,
.fcc-cw-window.fcc-cw-theme-dark .fcc-cw-fmt .fcc-cw-iconbtn.is-active {
  background: rgba(69, 185, 234, .22) !important;
  color: #9ddcff !important;
  box-shadow: inset 0 0 0 1px rgba(69, 185, 234, .4);
}

/* ---- rail badges --------------------------------------------------------
   The badge elements already existed on every rail button but nothing filled
   them. Positioned so a count never covers the icon. */
.fcc-cw-navitem { position: relative; }
.fcc-cw-navitem .fcc-cw-badge {
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; font-size: 10.5px; font-weight: 700; line-height: 17px;
  text-align: center; margin-left: auto;
}
.fcc-cw-botnav-item { position: relative; }

/* ---- message actions, edited and deleted states ---------------------- */
.fcc-cw-msg-more { opacity: 0; margin-left: auto; transition: opacity .12s ease; }
.fcc-cw-msg:hover .fcc-cw-msg-more,
.fcc-cw-msg-more:focus-visible { opacity: 1; }
.fcc-cw-msg-edited { font-size: 11px; color: #8b97a8; margin-left: 6px; }
.fcc-cw-msg-deleted {
  font-size: 13px; font-style: italic; color: #8b97a8;
  padding: 6px 0 2px;
}
.fcc-cw-msg-edit { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.fcc-cw-msg-edit textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 56px; }
.fcc-cw-msg-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
.fcc-cw-window.fcc-cw-dark .fcc-cw-msg-edited,
.fcc-cw-window.fcc-cw-dark .fcc-cw-msg-deleted { color: var(--fcc-text-2, #9aa8ba); }

/* ---- in-call participant roster and host controls -------------------- */
.fcc-cw-roster {
  margin: 8px 12px 12px; border: 1px solid var(--fcc-line, #e4e9f0);
  border-radius: 12px; background: var(--fcc-surface, #fff);
  max-height: 230px; overflow-y: auto;
}
.fcc-cw-roster-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--fcc-line, #e4e9f0);
}
.fcc-cw-roster-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid rgba(128,150,175,.12);
}
.fcc-cw-roster-row:last-child { border-bottom: 0; }
.fcc-cw-roster-name { flex: 1 1 auto; min-width: 0; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcc-cw-roster-row .fcc-cw-btn { padding: 4px 10px; font-size: 12px; }
.fcc-cw-hand { font-size: 13px; }
