/* Auto-generated by build.mjs — edit src/css/*.css instead. */
/* ---------- theme ---------- */
/* Module rail width; the rail toggle switches the expanded value. */
:root { --rail-w: 66px; }
/* User-chosen font (Settings → Appearance). Only non-default choices define
   --app-font, so each theme keeps its own default typeface until the user
   picks one. */
:root[data-font="inter"]    { --app-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="georgia"]  { --app-font: Georgia, "Times New Roman", Times, serif; }
:root[data-font="verdana"]  { --app-font: Verdana, Geneva, "DejaVu Sans", Tahoma, sans-serif; }
:root[data-font="trebuchet"]{ --app-font: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif; }
:root[data-font="mono"]     { --app-font: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, "Courier New", monospace; }
:root[data-font="caveat"]      { --app-font: "Caveat", "Comic Sans MS", cursive; }
:root[data-font="indie-flower"]  { --app-font: "Indie Flower", "Comic Sans MS", cursive; }
:root[data-font="patrick-hand"]  { --app-font: "Patrick Hand", "Comic Sans MS", cursive; }
:root[data-font="fredoka"]       { --app-font: "Fredoka", "Segoe UI Rounded", system-ui, sans-serif; }
:root[data-font="comic-neue"]    { --app-font: "Comic Neue", "Comic Sans MS", cursive; }
:root.rail-expanded { --rail-w: 192px; }
:root[data-theme="dark"] {
  --app-bg: #0b141a;
  --panel: #111b21;
  --panel-2: #202c33;
  --header: #202c33;
  --text: #e9edef;
  --text-soft: #c2ced5;
  --text-muted: #8696a0;
  --border: #222d34;
  --accent: #00a884;
  --accent-soft: rgba(0, 168, 132, .16);
  --bubble-out: #005c4b;
  --bubble-in: #202c33;
  --attach-bg: rgba(255, 255, 255, .08);
  --meta: rgba(233, 237, 239, .62);
  --tick-read: #53bdeb;
  --wallpaper: #0b141a;
  --hover: #202c33;
  --active: #2a3942;
  --input-bg: #2a3942;
  --search-bg: #202c33;
  --scroll: rgba(134, 150, 160, .35);
  --chip: rgba(32, 44, 51, .92);
  --shadow: 0 12px 36px rgba(0, 0, 0, .45);
  --tooltip-bg: #2a3942;
  --tooltip-text: #e9edef;
  --tooltip-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  --author-name-1: #53bdeb;
  --author-name-2: #ff8a80;
  --author-name-3: #8ee0a7;
  --author-name-4: #d7aefb;
  --author-name-5: #9db6ff;
  --author-name-6: #f6a6c1;
  --wallpaper-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.035' stroke-width='1.2' stroke-linecap='round'%3E%3Ccircle cx='24' cy='28' r='9'/%3E%3Cpath d='M78 18l6 13-13-4z'/%3E%3Cpath d='M112 78c-7 0-7 11 0 11s7-11 0-11z'/%3E%3Cpath d='M30 100l5 5 11-13'/%3E%3Crect x='92' y='24' width='15' height='15' rx='3'/%3E%3Cpath d='M10 66h20M20 56v20'/%3E%3Cpath d='M60 96c0 8 12 8 12 0s-12-8-12 0z'/%3E%3Cpath d='M104 116l8-8M104 108l8 8'/%3E%3C/g%3E%3C/svg%3E");
}
:root[data-theme="light"] {
  --app-bg: #d1d7db;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --header: #ffffff;
  --text: #111b21;
  --text-soft: #3d4a52;
  --text-muted: #667781;
  --border: #e9edef;
  --accent: #00a884;
  --accent-soft: rgba(0, 168, 132, .12);
  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
  --attach-bg: rgba(11, 20, 26, .05);
  --meta: rgba(17, 27, 33, .55);
  --tick-read: #53bdeb;
  --wallpaper: #efeae2;
  --hover: #f5f6f6;
  --active: #f0f2f5;
  --input-bg: #ffffff;
  --search-bg: #f0f2f5;
  --scroll: rgba(102, 119, 129, .35);
  --chip: rgba(255, 255, 255, .9);
  --shadow: 0 12px 36px rgba(11, 20, 26, .18);
  --tooltip-bg: #111b21;
  --tooltip-text: #ffffff;
  --tooltip-shadow: 0 8px 24px rgba(11, 20, 26, .22);
  --author-name-1: #1676b0;
  --author-name-2: #c53c4d;
  --author-name-3: #2f7c4f;
  --author-name-4: #6d4fc7;
  --author-name-5: #3e5fc2;
  --author-name-6: #a63d73;
  --wallpaper-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' stroke='%23111b21' stroke-opacity='0.045' stroke-width='1.2' stroke-linecap='round'%3E%3Ccircle cx='24' cy='28' r='9'/%3E%3Cpath d='M78 18l6 13-13-4z'/%3E%3Cpath d='M112 78c-7 0-7 11 0 11s7-11 0-11z'/%3E%3Cpath d='M30 100l5 5 11-13'/%3E%3Crect x='92' y='24' width='15' height='15' rx='3'/%3E%3Cpath d='M10 66h20M20 56v20'/%3E%3Cpath d='M60 96c0 8 12 8 12 0s-12-8-12 0z'/%3E%3Cpath d='M104 116l8-8M104 108l8 8'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--app-font, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif);
  background: var(--app-bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font-family: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

.app {
  display: flex;
  height: 100dvh;
  width: 100vw;
  background: var(--panel);
  overflow: hidden;
  transform-origin: center center;
  transition: transform .34s cubic-bezier(.22, 1, .36, 1), opacity .34s ease;
}
/* chat recedes into depth while the workspace is open */
body.ws-open .app {
  transform: scale(.986);
  opacity: .5;
  pointer-events: none;
}

/* ---------- sidebar ---------- */
.sidebar {
  width: clamp(300px, 26vw, 400px);
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  position: relative;
  z-index: 2;
}
.side-header {
  height: 68px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 18px;
  background: var(--header);
  position: relative;
  z-index: 3;
}
.avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 500;
  letter-spacing: .3px;
  flex: none;
  position: relative;
  user-select: none;
  overflow: visible;
}
.avatar.me {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #00a884, #008069);
}
.avatar.me svg { width: 22px; height: 22px; opacity: .95; }
.avatar .online-dot {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00d95f;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}

/* Soften the colored initials badges — a calmer, less saturated palette.
   Colors are already flattened and contrast-tuned in JS (`avatarTint`); the
   filter only removes saturation (no brightness boost, which would lighten
   the badge and hurt white-text contrast). Scoped with :has() so uploaded
   profile photos keep their true colors (browsers without :has() simply keep
   the original look). Task avatars are status badges, so they stay crisp. */
.avatar:not(.task-avatar):not(.group-avatar):not(:has(.avatar-img)),
.mini-avatar:not(:has(.avatar-img)),
.stack-av:not(.more):not(:has(.avatar-img)),
.profile-avatar:not(:has(.avatar-img)),
.menu-profile-avatar:not(:has(.avatar-img)) {
  filter: saturate(.78);
}
.avatar.group-avatar {
  background: linear-gradient(135deg, #667781, #4a5a63);
  color: #fff;
}
.avatar.group-avatar svg { width: 1.18em; height: 1.18em; display: block; }

/* Managed conversations (task / RFI / submittal / change order) print a short
   badge inside the avatar; it uses the same type as a regular chat's initials. */
.avatar-abbr {
  font-size: 1em;
  font-weight: 500;
  letter-spacing: .3px;
  line-height: 1;
  text-transform: uppercase;
}
.side-actions { display: flex; align-items: center; gap: 4px; }
#newChatBtn {
  width: 42px;
  height: 42px;
  background: var(--text);
  color: var(--panel);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .16);
}
#newChatBtn:hover { background: var(--accent); color: #fff; box-shadow: 0 3px 14px rgba(0, 168, 132, .32); }
#newChatBtn svg { width: 21px; height: 21px; }
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.danger:hover { color: #f15c6d; }

.search-wrap { padding: 10px 16px 12px; background: var(--panel); }
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--search-bg);
  border-radius: 12px;
  padding: 0 14px;
  height: 44px;
}
.search-box svg { width: 19px; height: 19px; color: var(--text-muted); flex: none; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input::-webkit-search-cancel-button { filter: invert(.6); }

.filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 0 16px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  border: 1px solid var(--scroll);
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.filter:hover { background: var(--hover); color: var(--text); }
.filter.active { background: var(--panel-2); border-color: var(--accent); color: var(--text); }

.chat-list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px 0 8px; }
.chat-load-more {
  display: block;
  margin: 10px auto 6px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--hover);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.chat-load-more:hover { background: var(--active); color: var(--text); }
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 3px 8px;
  padding: 9.5px 10px;
  height: 77px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .12s ease;
  outline: none;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
/* Breathing room between the archived / closed row and the first conversation. */
.archived-row + .chat-item { margin-top: 8px; }
/* While a reordered row slides, give it an opaque background so it covers the
   rows it travels over (the base .chat-item is transparent). */
.chat-item.reordering {
  position: relative;
  z-index: 2;
  background: var(--panel);
  will-change: transform;
}
.chat-item.active.reordering { background: var(--active); }
.chat-item .avatar { width: 48px; height: 48px; }
.chat-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.chat-row1 { display: flex; align-items: center; gap: 8px; }
.chat-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -.1px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Slightly tighter conversation titles on large displays. */
@media (min-width: 1280px) {
  .chat-name { font-size: 15px; }
}
.chat-time {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-time .pin svg { width: 14px; height: 14px; display: block; }
.chat-row2 { display: flex; align-items: center; gap: 8px; min-height: 19px; }
.chat-preview {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 19px;
}
.prev-tick { display: inline-flex; vertical-align: -2px; margin-right: 3px; color: var(--text-muted); }
.prev-tick svg { width: 16px; height: 11px; }
.prev-tick svg.read { color: var(--tick-read); }
.prev-author { color: var(--text); opacity: .85; }
.badge {
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  display: grid;
  place-items: center;
  line-height: 1;
}
.chat-flag {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(240, 178, 50, .18);
  color: #f0b232;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.35;
  white-space: nowrap;
}
:root[data-theme="light"] .chat-flag { background: #fff4e0; color: #8a5a00; }

.mention-badge {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
}
.list-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.list-empty p { margin: 0 0 6px; color: var(--text); font-size: 15px; }
.list-empty span { font-size: 13px; }

.side-footer {
  flex: none;
  padding: 12px 16px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
  background: var(--panel);
}
.side-footer svg { width: 14px; height: 14px; flex: none; }

/* ---------- chat panel ---------- */
.chat-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--wallpaper);
  background-image: var(--wallpaper-pattern);
}
.chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  position: relative;
}
.chat-header {
  height: 68px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 5;
}
.chat-header .back { display: none; }
.chat-avatar { width: 36px; height: 36px; font-size: 14px; }
.chat-title { flex: 1; min-width: 0; cursor: pointer; border-radius: 8px; }
.chat-title:hover h2 { color: var(--accent); }
.chat-avatar { cursor: pointer; }
.chat-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-title p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-title p.online { color: var(--accent); }
.chat-actions { display: flex; align-items: center; gap: 2px; }

/* ---------- pinned message banner ---------- */
.pinned-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 10px 0 14px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 3px 0 0 var(--accent);
  min-height: 46px;
}
.pinned-jump {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.pinned-jump:hover .pinned-copy b { color: var(--accent); }
.pinned-icon { flex: none; display: inline-flex; color: var(--accent); }
.pinned-icon svg { width: 16px; height: 16px; }
.pinned-copy { min-width: 0; display: flex; flex-direction: column; line-height: 16px; }
.pinned-copy b { font-size: 12px; font-weight: 600; color: var(--accent); }
.pinned-copy span {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-unpin {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.pinned-unpin:hover { background: var(--hover); color: var(--text); }
.pinned-unpin svg { width: 15px; height: 15px; }

/* ---------- empty state ---------- */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  border-bottom: 6px solid var(--accent);
  background: var(--panel);
}
.empty-logo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  color: var(--accent);
  margin-bottom: 24px;
}
.empty-logo svg { width: 48px; height: 48px; }
.empty-state h1 { margin: 0 0 10px; font-size: 30px; font-weight: 300; letter-spacing: -.3px; }
.empty-state p { margin: 0; max-width: 440px; color: var(--text-muted); font-size: 14px; line-height: 1.55; }
.empty-note {
  margin-top: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}
.empty-note svg { width: 14px; height: 14px; }

/* ---------- messages ---------- */
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  /* 30px of breathing room at the panel edges on big screens (15px on
     phones, set below). */
  padding: 14px 30px 22px;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  /* Avatar slot reserved beside incoming bubbles (28px avatar + 8px gap).
     1:1 chats leave it empty so their bubbles start at the same x as group
     bubbles — WhatsApp reserves this column in every conversation. */
  --avatar-slot: 36px;
}
.day-chip {
  align-self: center;
  margin: 12px 0 10px;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--chip);
  color: var(--text-muted);
  font-size: 12px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 1;
}
.messages-empty {
  margin: auto;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--chip);
  color: var(--text-muted);
  font-size: 13px;
}
.bubble {
  position: relative;
  max-width: min(66%, 560px);
  width: fit-content;
  padding: 6px 9px 10px;
  border-radius: 20px;
  font-size: 14.5px;
  line-height: 20px;
  color: var(--text);
  box-shadow: 0 1px .6px rgba(0, 0, 0, .16);
  margin-top: 2px;
}
.bubble.first { margin-top: 9px; }
.bubble.out { align-self: flex-end; background: var(--bubble-out); --bubble-fill: var(--bubble-out); border-top-right-radius: 20px; }
.bubble.in { align-self: flex-start; background: var(--bubble-in); --bubble-fill: var(--bubble-in); border-top-left-radius: 20px; }
/* The pointer marks the *first* bubble of a sender's run (where the avatar and
   author name sit), so it merges into the top corner and points up towards the
   sender instead of trailing off the bottom of the last bubble. */
.bubble.tail.out { border-top-right-radius: 0; }
.bubble.tail.in { border-top-left-radius: 0; }
/* The hook protrudes 5px from the bubble edge so, with the 10px message
   padding, its tip sits 5px clear of the panel edge. */
.bubble.tail.out::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 0;
  width: 6px;
  height: 14px;
  background: var(--bubble-out);
  clip-path: polygon(0 0, 0 100%, 100% 0);
}
.bubble.tail.in::after {
  content: "";
  position: absolute;
  left: -5px;
  top: 0;
  width: 6px;
  height: 14px;
  background: var(--bubble-in);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
}
.msg-text { white-space: pre-wrap; word-break: break-word; }
.author {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 17px;
}
.meta {
  float: right;
  margin: 6px 0 -3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  line-height: 15px;
  color: var(--meta);
  white-space: nowrap;
  position: relative;
  top: 2px;
}
.meta.inline { float: none; margin: 0 0 0 auto; top: 0; align-self: flex-end; }
.tick { color: var(--meta); flex: none; }
.tick.delivered { color: var(--meta); }
.tick.read { color: var(--tick-read); }
.tick-btn {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  color: inherit;
  cursor: pointer;
  line-height: 0;
  vertical-align: -2px;
  border-radius: 4px;
}
.tick-btn:hover { opacity: .72; }
.tick-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* voice notes */
.bubble:has(.voice) { padding: 6px 10px 6px 8px; }
.voice { display: flex; align-items: center; gap: 9px; min-width: 270px; }
.play-btn {
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: rgba(134, 150, 160, .22);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.play-btn svg { width: 16px; height: 16px; }
.play-btn:hover { background: rgba(134, 150, 160, .35); }
.play-btn:disabled { cursor: default; opacity: .5; }
.play-btn.retry { background: rgba(241, 92, 109, .18); color: #f15c6d; }
.play-btn.retry:hover { background: rgba(241, 92, 109, .3); }
.wave { display: flex; align-items: center; gap: 2px; height: 24px; flex: 1; cursor: pointer; }
.wave i {
  width: 2.5px;
  border-radius: 2px;
  background: currentColor;
  opacity: .4;
  transform-origin: center;
}
.wave i.on { opacity: 1; background: var(--accent); }
.voice.playing .wave i.on { animation: wave 1s ease-in-out infinite; }
.voice.playing .wave i.on:nth-child(3n) { animation-delay: .12s; }
.voice.playing .wave i.on:nth-child(3n + 1) { animation-delay: .24s; }
.voice.playing .wave i.on:nth-child(4n) { animation-delay: .36s; }
@keyframes wave {
  0%, 100% { transform: scaleY(.6); }
  50% { transform: scaleY(1.3); }
}
.dur { font-size: 11.5px; color: var(--meta); flex: none; font-variant-numeric: tabular-nums; }
.voice .wave { min-width: 0; }
.voice.unavailable { opacity: .55; }
.voice.unavailable .wave { cursor: default; }
.voice.pending .wave i { opacity: .25; }
.voice-rate {
  flex: none;
  border: 0;
  background: rgba(134, 150, 160, .18);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  min-width: 30px;
}
.voice-rate:hover { background: rgba(134, 150, 160, .32); }
.voice-cancel {
  flex: none;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--meta);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.voice-cancel svg { width: 13px; height: 13px; }
.voice-cancel:hover { background: rgba(134, 150, 160, .25); color: var(--text); }
.voice-ring {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text);
  background: conic-gradient(var(--accent) var(--p, 0%), rgba(134, 150, 160, .22) 0);
}
.voice-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--bubble-fill, var(--panel));
}
.voice-ring span { position: relative; z-index: 1; }
.voice-ring.sending { animation: spinRing .9s linear infinite; background: conic-gradient(rgba(134, 150, 160, .22) 0 70%, var(--accent) 100%); }
.voice-ring.sending::before { display: none; }

/* photo */
.bubble:has(.photo) { padding: 4px 4px 6px; max-width: min(74%, 330px); }
.photo {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 76% 26%, #ffe9a3 0 11%, transparent 12%),
    linear-gradient(170deg, #7fb9df 0%, #b9dced 46%, #6f9f5e 46.5%, #3f6b3a 100%);
}
.photo::before {
  content: "";
  position: absolute;
  left: -24%;
  bottom: -34%;
  width: 110%;
  height: 92%;
  background: #487a45;
  clip-path: polygon(52% 0, 100% 100%, 0 100%);
  transform: rotate(-7deg);
}
.photo::after {
  content: "";
  position: absolute;
  right: -18%;
  bottom: -40%;
  width: 95%;
  height: 88%;
  background: #33582f;
  clip-path: polygon(46% 0, 100% 100%, 0 100%);
  transform: rotate(5deg);
}
.photo.has-img { background: #0b141a; cursor: pointer; }
.photo.has-img::before,
.photo.has-img::after { display: none; }
.photo-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.caption {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 5px 6px 1px 7px;
  font-size: 14px;
  line-height: 19px;
  min-height: 24px;
}
.caption > span:first-child { flex: 1; word-break: break-word; white-space: pre-wrap; }

/* progressive message history */
.messages-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 180px;
  color: var(--text-muted);
  font-size: 12.5px;
}
.messages-loading.small {
  min-height: 0;
  padding: 8px 0 10px;
  font-size: 11.5px;
}
.load-earlier {
  display: block;
  margin: 8px auto 10px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--hover);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.load-earlier:hover { background: var(--active); color: var(--text); }

/* documents */
.bubble:has(.doc) { padding: 4px 4px 6px; }
.doc {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  padding: 9px 10px;
  border-radius: 16px;
  background: var(--attach-bg);
}
.doc-icon {
  flex: none;
  width: 36px;
  height: 42px;
  border-radius: 5px;
  background: #f15c6d;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: .5px;
}
.doc-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc-name {
  font-size: 14px;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-size { font-size: 11.5px; color: var(--meta); margin-top: 1px; }
.doc.file { cursor: pointer; }
.doc.file:hover .doc-name { text-decoration: underline; }
.doc-dl {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-muted);
}
.doc-dl:hover { background: var(--hover); color: var(--text); }
.doc-dl svg { width: 16px; height: 16px; }
/* Keep the file name clear of the download control: the timestamp/ticks sit
   beside the name and the download button is pushed to the far edge of the
   card, so it can never crowd the title. */
.doc > .doc-info { order: 1; }
.doc > .meta.inline { order: 2; }
.doc > .doc-retry,
.doc > .doc-cancel { order: 2; }
.doc > .doc-dl { order: 3; }
.doc-icon-word { background: #2b579a; }
.doc-icon-sheet { background: #217346; }
.doc-icon-slide { background: #d24726; }
.doc-icon-file { background: #54656f; }
.doc-icon-video { background: #7b1fa2; }

/* typing indicator */
.typing-row {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  margin-left: 0;
  max-width: min(66%, 560px);
}
/* Group-style conversations line the typing bubble up with the avatar column. */
.typing-row.has-avatar { margin-left: var(--avatar-slot); }
.typing-row .bubble.typing {
  margin-top: 0;
  padding: 11px 13px;
  max-width: none;
  align-self: center;
}
.typing-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.bubble.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
  margin-top: 9px;
}
.tdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.3s infinite ease-in-out;
}
.tdot:nth-child(2) { animation-delay: .18s; }
.tdot:nth-child(3) { animation-delay: .36s; }
@keyframes blink {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- composer ---------- */
.composer {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 16px;
  background: var(--header);
  position: relative;
  z-index: 6;
}
.composer > .icon-btn { flex: none; align-self: center; }

/* editing a message */
.edit-bar {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 4px;
  padding: 7px 8px 7px 11px;
  border-left: 3px solid var(--accent);
  background: var(--input-bg);
  border-radius: 8px;
}
.edit-bar-icon { flex: none; display: inline-flex; color: var(--accent); }
.edit-bar-icon svg { width: 16px; height: 16px; }
.edit-bar-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  line-height: 15px;
}
.edit-bar-copy em {
  font-style: normal;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edit-bar .icon-btn { flex: none; width: 30px; height: 30px; }

/* replying to a message */
.reply-bar {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 4px;
  padding: 7px 8px 7px 11px;
  border-left: 3px solid var(--accent);
  background: var(--input-bg);
  border-radius: 8px;
}
.reply-bar-icon { flex: none; display: inline-flex; color: var(--accent); }
.reply-bar-icon svg { width: 16px; height: 16px; }
.reply-bar-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
  line-height: 15px;
}
.reply-bar-copy b {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-bar-copy em {
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-bar .icon-btn { flex: none; width: 30px; height: 30px; }
.input-wrap {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border-radius: 20px;
  padding: 9px 12px;
  min-height: 42px;
  display: flex;
  align-items: center;
}
.input-wrap textarea {
  width: 100%;
  max-height: 120px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 21px;
  padding: 0;
  margin: 0;
  overflow-y: auto;
}
.input-wrap textarea::placeholder { color: var(--text-muted); }
.send-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.send-btn svg { width: 22px; height: 22px; }
.send-btn:hover { background: var(--hover); color: var(--text); }
.send-btn.active { background: var(--accent); color: #fff; }
.send-btn.active:hover { background: #06b78f; color: #fff; }
.send-btn:active { transform: scale(.94); }

/* recording */
.recording {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 42px;
  padding: 0 8px 0 14px;
  background: var(--input-bg);
  border-radius: 8px;
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f15c6d;
  flex: none;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}
.rec-time { font-size: 14px; font-variant-numeric: tabular-nums; flex: none; }
.rec-wave { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; height: 24px; }
.rec-wave i {
  flex: 1;
  min-width: 2px;
  max-width: 4px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .85;
  transition: height .06s linear;
}
.rec-send {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.rec-send svg { width: 16px; height: 16px; }
.composer.recording .input-wrap,
.composer.recording #emojiBtn,
.composer.recording #attachBtn,
.composer.recording .send-btn { display: none; }

/* ---------- popovers ---------- */
.popover {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 80;
}
.menu-pop {
  position: absolute;
  top: 62px;
  right: 12px;
  width: 208px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.3;
}
.menu-item:hover { background: var(--hover); }
.menu-item svg { width: 18px; height: 18px; color: var(--text-muted); flex: none; }
.menu-item.danger { color: #f15c6d; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }

.emoji-pop {
  position: absolute;
  left: 12px;
  bottom: 62px;
  width: 330px;
  max-height: 296px;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.emoji {
  border: 0;
  background: transparent;
  font-size: 21px;
  line-height: 1;
  padding: 5px 0;
  border-radius: 6px;
  cursor: pointer;
}
.emoji:hover { background: var(--hover); }

.attach-pop {
  position: absolute;
  left: 58px;
  bottom: 62px;
  width: 194px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mention-pop {
  position: fixed;
  width: 252px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
}
.mention-item:hover,
.mention-item.active { background: var(--hover); }
.mention-item .mini-avatar { width: 28px; height: 28px; font-size: 10px; }
.mention-item .mi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-item .mi-you { font-size: 10.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.reaction-pop {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px;
  border-radius: 999px;
}
.reaction-pop .emoji {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 21px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: transform .12s ease, background .12s ease;
}
.reaction-pop .emoji:hover {
  background: var(--hover);
  transform: scale(1.2);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  background: #202c33;
  color: #e9edef;
  font-size: 13.5px;
  padding: 11px 20px;
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 200;
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .bubble { max-width: 72%; }
}
@media (max-width: 820px) {
  .sidebar { width: 100%; min-width: 0; border-right: 0; }
  .chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    z-index: 30;
    transform: translateX(100%);
    transition: transform .24s ease;
  }
  .app.chat-open .chat-panel { transform: translateX(0); }
  .chat-header .back { display: grid; }
  .chat-header { padding: 0 6px; gap: 8px; }
  .chat-header .chat-actions .icon-btn { width: 38px; height: 38px; }
  .messages { padding: 10px 15px 16px; }
  .bubble { max-width: 86%; }
  .composer {
    padding: 7px 8px calc(17px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
  }
  .composer > .icon-btn { width: 38px; height: 38px; }
  .input-wrap textarea { font-size: 16px; line-height: 22px; }
  .emoji-pop { left: 8px; right: 8px; width: auto; }
  .attach-pop { left: 48px; }
  .side-footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
/* Floating shortcut back to the live tail when scrolled up (or parked in an
   older search window). The bottom offset is set in JS from the composer. */
.jump-latest {
  position: absolute;
  right: 22px;
  bottom: 86px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .24);
}
.jump-latest[hidden] { display: none; }
.jump-latest:hover { border-color: var(--accent); color: var(--accent); }
.jump-latest svg { width: 14px; height: 14px; }
@media (max-width: 820px) {
  .jump-latest { right: 12px; padding: 7px 12px; font-size: 11.5px; }
}

/* ---------- in-chat message search ---------- */
.chat-search {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 12px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}
.chat-search[hidden] { display: none; }
.chat-search-row { display: flex; align-items: center; gap: 6px; }
.chat-search-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}
.chat-search-icon svg { width: 16px; height: 16px; }
.chat-search input {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.3;
  outline: none;
}
.chat-search input::placeholder { color: var(--text-muted); }
.chat-search-count {
  flex: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chat-search .icon-btn { width: 30px; height: 30px; flex: none; }
.chat-search .icon-btn svg { width: 17px; height: 17px; }
.chat-search .icon-btn:disabled { opacity: .35; cursor: default; }
.chat-search .icon-btn:disabled:hover { background: transparent; color: var(--text-muted); }
/* matches inside rendered bubbles (search only wraps text nodes, so the
   conversation layout is untouched) */
mark.msg-search-hit {
  border-radius: 3px;
  background: rgba(255, 205, 60, .55);
  color: inherit;
  box-shadow: 0 0 0 1px rgba(255, 205, 60, .55);
}
mark.msg-search-hit.active {
  background: #ffb300;
  color: #1a1200;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
}
/* the message that the selected result lives in */
.msg-row.msg-search-current .bubble {
  box-shadow: 0 0 0 2px rgba(255, 179, 0, .6);
}

@media (prefers-reduced-motion: reduce) {
  .chat-search { scroll-behavior: auto; }
}

@media (max-width: 820px) {
  .chat-search { padding: 6px 8px; }
  .chat-search input { font-size: 16px; padding: 4px 2px; }
  .chat-search-count { font-size: 11px; }
  .chat-search .icon-btn { width: 32px; height: 32px; }
}

@media (max-width: 400px) {
  .voice { min-width: 210px; }
}

/* ============================================================
   Tangible additions
   ============================================================ */

/* brand */
.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #007a63);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  display: grid;
  place-items: center;
  letter-spacing: -.5px;
  box-shadow: 0 2px 10px rgba(0, 168, 132, .28);
}
.brand-copy { flex: 1; min-width: 0; margin-left: 0; }
.brand-copy h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
/* Names the active module in the sticky header. On phones it also takes over
   once the top controls scroll away; on desktop `module-named` switches it in
   as soon as a non-Chats / non-Files module is opened. */
.header-module-name { display: none; }
.sidebar.module-named .brand-copy h1,
.sidebar.module-named .brand-copy [data-company-name] { display: none; }
.sidebar.module-named .header-module-name {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
  animation: headerModuleIn .18s ease;
}
@keyframes headerModuleIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.brand-copy span {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* filter task count */
.filter .filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 3px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  vertical-align: 1px;
}
.filter.active .filter-count { background: var(--accent); color: #fff; }

/* workspace switcher */
.workspace-switch {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  margin: 6px 8px 10px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.workspace-switch:hover { background: var(--hover); }
.ws-icon {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text-muted);
  display: grid;
  place-items: center;
}
.ws-icon svg { width: 19px; height: 19px; }
.ws-copy { flex: 1; min-width: 0; }
.ws-copy b { display: block; font-size: 14px; font-weight: 600; }
.ws-copy small { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.ws-chev { color: var(--text-muted); font-size: 18px; line-height: 1; }

/* task button badge in chat header */
.tasks-toggle { position: relative; }
.task-count {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--header);
  line-height: 1;
}
.task-count:empty, .task-count[data-zero="true"] { display: none; }

/* message rows (wrapper for bubble + hover actions) */
.msg-row {
  /* Group rows carry the avatar column (28px + 8px) *in addition to* the
     bubble's usual width, so the bubble keeps the same max width — and the same
     wrapping/spacing — as a 1:1 chat. */
  --avatar-gutter: 0px;
  --row-max: min(66%, 560px);
  display: flex;
  flex-direction: column;
  max-width: min(calc(var(--row-max) + var(--avatar-gutter)), 100%);
  position: relative;
}
.msg-row.out { align-self: flex-end; align-items: flex-end; }
.msg-row.in { align-self: flex-start; align-items: flex-start; }
/* Only group incoming rows keep the avatar column. 1:1 incoming bubbles and
   every outgoing bubble sit at the panel padding so their hook lands 5px from
   the panel edge (see .bubble.tail in 02-messages-composer.css). */
/* Multi-member conversations reserve a small avatar column beside incoming
   bubbles. The column is added *outside* the bubble's usual width, so bubbles
   keep the same max width (and therefore the same wrapping/spacing) as a 1:1
   chat. The avatar appears at the start of a run of messages from one sender,
   while the empty slots keep every bubble aligned. */
.msg-row.has-avatar {
  --avatar-gutter: var(--avatar-slot);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
  justify-items: start;
}
.msg-row.has-avatar .bubble { grid-column: 2; grid-row: 1; }
.msg-row.has-avatar .reactions { grid-column: 2; grid-row: 2; justify-self: start; }
.msg-avatar {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}
.msg-avatar .mini-avatar { width: 28px; height: 28px; font-size: 12px; }
.msg-avatar.empty { visibility: hidden; }
/* consecutive bubbles keep a gap (the old in-flow action row used to supply
   it; the hover actions are now absolutely positioned). */
.msg-row + .msg-row { margin-top: 5px; }
.msg-row.first { margin-top: 9px; }
.msg-row .bubble { max-width: 100%; margin-top: 0; }
.msg-row.is-photo { width: 100%; --row-max: min(33%, 280px); }
.msg-row.is-voice { --row-max: min(82%, 390px); }
/* Documents need more width than a single photo: the name, the timestamp and
   the download button share one row, so a photo-sized card squeezed the title. */
.msg-row.is-doc { width: 100%; --row-max: min(48%, 400px); }
.msg-row.is-task { width: 100%; --row-max: min(66%, 560px); }

/* hover actions float beside the bubble (WhatsApp-style) */
.msg-hover-actions {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .13s ease;
  z-index: 4;
}
/* The 6px gap to the bubble is padding (not margin) and the box spans the whole
   row height, so the pointer stays inside the row — and the icons stay visible —
   while it is over the message, the gap, or the buttons themselves. */
.msg-row.in .msg-hover-actions { left: 100%; padding-left: 6px; }
.msg-row.out .msg-hover-actions { right: 100%; padding-right: 6px; }
.msg-row:hover .msg-hover-actions,
.msg-row:focus-within .msg-hover-actions { opacity: 1; pointer-events: auto; }
.msg-act {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .16);
  transition: color .13s ease, border-color .13s ease;
}
.msg-act:hover { color: var(--accent); border-color: var(--accent); }
.msg-act svg { width: 16px; height: 16px; }
/* Keep the hover actions visible while their message menu is open. */
.bubble.menu-open + .msg-hover-actions { opacity: 1; pointer-events: auto; }
.msg-row.flash .bubble { animation: msgFlash 1.15s ease; }
@keyframes msgFlash {
  0%, 100% { box-shadow: 0 1px .6px rgba(0, 0, 0, .16); }
  30% { box-shadow: 0 0 0 3px var(--accent); }
}
/* forwarded marker above the message body */
.msg-forwarded {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 1px 0 5px;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  line-height: 16px;
}
.msg-forwarded svg { width: 13px; height: 13px; opacity: .85; }
/* quoted reply above the message body */
.msg-quote {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin: 3px 0 6px;
  padding: 5px 8px;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: rgba(127, 127, 127, .14);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.msg-quote:hover { background: rgba(127, 127, 127, .22); }
.msg-quote-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.msg-quote-copy b { font-size: 12.5px; font-weight: 600; color: var(--accent); line-height: 16px; }
.msg-quote-copy span {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-row.editing .bubble { box-shadow: 0 0 0 2px var(--accent); }
.meta .edited { font-style: normal; margin-right: 2px; opacity: .85; }
.deleted-text { font-style: italic; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.deleted-text svg { width: 13px; height: 13px; opacity: .8; }

/* message reactions — a single pill that overlaps the bubble edge */
.reactions {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: -2px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 1px 4px;
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
  transition: transform .12s ease;
}
.reaction-pill:hover { transform: translateY(-1px); }
/* reactions you made are marked with an accent count, never a background tint */
.reaction-pill.mine span { color: var(--accent); }
.reaction-pill span { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }

/* mentions + activity */
.mention {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 0 6px;
  font-weight: 600;
}
.mention.me {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 1px var(--accent);
}
.mention.me:hover { background: #06b78f; }
.activity-chip {
  align-self: center;
  max-width: 82%;
  margin: 7px 0;
  padding: 5px 11px;
  border-radius: 7px;
  background: var(--chip);
  color: var(--text-muted);
  font-size: 11.5px;
  text-align: center;
  line-height: 1.4;
}
.activity-chip.voided-notice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #f15c6d;
  background: rgba(241, 92, 109, .1);
}
.activity-chip.voided-notice svg { width: 13px; height: 13px; flex: none; }

/* inline task cards */
.msg-row.is-task .bubble {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(0, 0, 0, .14);
  width: 100%;
}
/* Photo/document attachments fill their row so the 60% cap is the real width. */
.msg-row.is-photo .bubble,
.msg-row.is-doc .bubble { width: 100%; max-width: 100%; }
.msg-row.is-task .bubble::after { display: none; }
.task-card {
  cursor: pointer;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.msg-row.is-task .bubble:hover { border-color: var(--accent); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.msg-row.is-task .bubble:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.task-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.task-card-head svg { width: 14px; height: 14px; flex: none; }
.task-card-head .task-card-time {
  margin-left: auto;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.task-card-body { padding: 10px 12px 12px; }
.task-card-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.task-card-sub { margin-top: 9px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-card-person { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); }
.task-card-due { font-size: 11.5px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.task-card-due svg { width: 12px; height: 12px; }
.task-status-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.task-status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.task-status-pill.assigned { color: var(--text-muted); }
.task-status-pill.in_progress { color: #f0b232; border-color: rgba(240, 178, 50, .45); background: rgba(240, 178, 50, .1); }
.task-status-pill.review { color: #8f7cf6; border-color: rgba(143, 124, 246, .45); background: rgba(143, 124, 246, .12); }
.task-status-pill.closed { color: var(--accent); border-color: rgba(0, 168, 132, .45); background: var(--accent-soft); }
.task-status-pill.voided { color: #f15c6d; border-color: rgba(241, 92, 109, .45); background: rgba(241, 92, 109, .1); }
.task-card.voided { opacity: .82; }
.task-card-desc {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-card-atts {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  max-width: 100%;
}
.task-atts-label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.task-card-atts svg { width: 12px; height: 12px; }
.task-atts-kinds { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); opacity: .85; }
.task-atts-kinds span { display: inline-flex; align-items: center; gap: 3px; }
.task-card-foot-right { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.proof-flag { color: var(--accent) !important; font-weight: 600; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .stack-av {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: .2px;
  border: 1.5px solid var(--panel);
  margin-left: -5px;
}
.avatar-stack .stack-av:first-child { margin-left: 0; }
.avatar-stack .stack-av.more { background: var(--chip); color: var(--text-muted); }
.person-names { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.task-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-muted);
}
.task-card-foot span { display: inline-flex; align-items: center; gap: 4px; }
.task-card-foot svg { width: 12px; height: 12px; }
.task-source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-muted);
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}
.task-source-link:hover { color: var(--accent); }
.task-source-link svg { width: 12px; height: 12px; }
/* Copy the shareable deep link to this task's conversation. */
.task-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.task-copy-link:hover,
.task-copy-link:focus-visible { color: var(--accent); }
.task-copy-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.task-copy-link svg { width: 12px; height: 12px; }
.task-copy-link.copied { color: var(--accent); }
@media (max-width: 820px) {
  .task-card-foot .task-copy-label { display: none; }
}
.msg-row.flash .bubble { animation: cardFlash 1.3s ease; }
@keyframes cardFlash {
  0%, 100% { box-shadow: 0 3px 14px rgba(0, 0, 0, .14); }
  25%, 65% { box-shadow: 0 0 0 3px var(--accent-soft), 0 3px 18px rgba(0, 168, 132, .35); }
}
.mini-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 8px;
  font-weight: 500;
  flex: none;
  letter-spacing: .2px;
  position: relative;
  overflow: hidden;
}

.task-list .list-subhead {
  padding: 14px 8px 4px;
}
.task-list .list-subhead b { font-size: 9.5px; }

/* composer task button */
.composer-task {
  flex: none;
  align-self: center;
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.composer-task svg { width: 15px; height: 15px; }
.composer-task:hover { color: var(--accent); border-color: var(--accent); }
.composer.recording .composer-task { display: none; }

/* ============================================================
   Offline-first queue
   ============================================================ */
.offline-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 0 0 10px 10px;
  background: #2c3e50;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,.25);
}
.offline-banner[hidden] { display: none; }
.offline-banner svg { width: 15px; height: 15px; flex: none; }
.offline-banner b { color: #ffd479; }
.offline-banner button {
  margin-left: 6px;
  padding: 3px 9px;
  font-size: 11px;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 5px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.offline-banner button:hover { background: rgba(255,255,255,.12); }

.pending-tick.queued,
.meta.pending .pending-tick.queued { color: var(--text-muted); }
.msg-row.out .bubble.pending-text { opacity: .72; }

/* ============================================================
   Task panel
   ============================================================ */
.tasks-panel {
  width: 360px;
  flex: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  position: relative;
  z-index: 2;
}
.app.tasks-hidden .tasks-panel { display: none; }
.tasks-header {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 17px 12px 12px 16px;
}
.tasks-heading-copy { min-width: 0; }
.tasks-heading-copy > span {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-muted);
}
.tasks-heading-copy h2 {
  margin: 4px 0 0;
  font-size: 15.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tasks-header .icon-btn { flex: none; margin-top: -4px; }
.tasks-header .icon-btn svg { width: 18px; height: 18px; }
.task-stats {
  flex: none;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 16px;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.task-stats > div { display: flex; flex-direction: column; gap: 2px; }
.task-stats b { font-size: 20px; font-weight: 700; line-height: 1; }
.task-stats small {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
}
.task-stats button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.tasks-subhead {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 7px;
}
.tasks-subhead b {
  font-size: 9.5px;
  letter-spacing: .09em;
  color: var(--text-muted);
  font-weight: 700;
}
.tasks-subhead button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.tasks-subhead button:hover { background: var(--hover); }
.task-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; }
.side-task {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.side-task:hover { background: var(--hover); }
.side-task.selected { background: var(--accent-soft); }
.side-task .status-dot {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 2px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  position: relative;
}
.side-task.assigned .status-dot { border-color: var(--text-muted); }
.side-task.in_progress .status-dot { border-color: #f0b232; }
.side-task.in_progress .status-dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #f0b232;
}
.side-task.review .status-dot { border-color: #8f7cf6; }
.side-task.review .status-dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #8f7cf6;
}
.side-task.closed .status-dot { background: var(--accent); border-color: var(--accent); }
.side-task.closed .status-dot::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 2.5px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(42deg);
}
.side-task > div { min-width: 0; flex: 1; }
.side-task b {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-task.closed b { text-decoration: line-through; color: var(--text-muted); }
.side-task small {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-task .side-names { overflow: hidden; text-overflow: ellipsis; }

.task-list-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.new-task {
  flex: none;
  margin: 8px 16px 16px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.new-task:hover { background: #06b78f; }

/* ============================================================
   Task modal
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 65;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
}
.task-modal {
  width: min(600px, 100%);
  max-height: min(92dvh, 780px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.task-modal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 22px 24px 14px 26px;
}
.task-modal header span {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--accent);
}
.task-modal h2 { margin: 5px 0 0; font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.task-modal header .icon-btn { margin-top: -4px; }
.detail-title-wrap { min-width: 0; flex: 1; }
.detail-title-row { display: flex; align-items: center; gap: 4px; }
.detail-title-row h2 { margin: 0; min-width: 0; }
.task-modal header .task-detail-copy-link { flex-shrink: 0; width: 28px; height: 28px; margin-top: 0; color: var(--text-faint); }
.task-detail-copy-link svg { width: 16px; height: 16px; }
.task-detail-copy-link:hover, .task-detail-copy-link:focus-visible { color: var(--accent); }
.task-detail-copy-link.copied { color: var(--accent); }
.detail-desc-empty { color: var(--text-faint); font-style: italic; }
.source-quote {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 24px 16px;
  padding: 10px 12px;
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}
.source-quote p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.source-quote .mini-avatar { margin-top: 1px; }

/* message read-receipt info */
.message-info { width: min(420px, 100%); }
.mi-quote {
  margin: 0 20px 14px;
  padding: 10px 12px;
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-word;
}
.mi-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 20px 8px;
  padding: 12px;
  background: var(--panel-2);
  border-radius: 10px;
}
.mi-status-icon { display: inline-flex; color: var(--tick-read); }
.mi-status-icon svg { width: 22px; height: 14px; }
.mi-status b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.mi-status span { font-size: 11.5px; color: var(--text-muted); }
.mi-list { padding: 6px 12px 4px; max-height: 280px; overflow-y: auto; }
.mi-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border-radius: 8px;
}
.mi-row:hover { background: var(--hover); }
.mi-row .mini-avatar { width: 32px; height: 32px; font-size: 11px; }
.mi-row-main { flex: 1; min-width: 0; }
.mi-row-name { font-size: 13.5px; line-height: 1.3; }
.mi-row-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.mi-row-sub.read { color: var(--tick-read); }
.mi-empty { padding: 14px 8px; font-size: 12.5px; color: var(--text-muted); }
.mi-note {
  padding: 10px 20px 18px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
  opacity: .8;
}
.task-modal .field {
  display: block;
  padding: 0 24px 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.task-modal .field input,
.task-modal .field select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.task-modal .field input:focus,
.task-modal .field select:focus { border-color: var(--accent); }
:root[data-theme="dark"] .task-modal input[type="date"] { color-scheme: dark; }
:root[data-theme="light"] .task-modal input[type="date"] { color-scheme: light; }
.task-modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.task-modal footer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 0 0 16px 16px;
}
.task-modal footer button {
  border: 0;
  border-radius: 8px;
  padding: 9px 15px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.task-modal footer button:hover { background: var(--hover); color: var(--text); }
.task-modal footer .primary { background: var(--accent); color: #fff; }
.task-modal footer .primary:hover { background: #06b78f; color: #fff; }
.task-modal footer button:disabled { opacity: .45; cursor: not-allowed; }
.task-modal .field textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  outline: none;
  resize: vertical;
}
.task-modal .field textarea:focus { border-color: var(--accent); }
.field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.field-label em { font-style: normal; font-weight: 500; opacity: .7; }
.people-field { padding-bottom: 12px !important; }
.chip-picker {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  margin-top: 7px;
  height: 72px;
  overflow-y: auto;
  padding-right: 2px;
}
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.person-chip:hover { border-color: var(--accent); }
.person-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.person-chip .mini-avatar { width: 20px; height: 20px; font-size: 8.5px; flex: none; }
.person-chip-copy { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.person-chip-copy b { font: inherit; font-weight: 600; white-space: nowrap; }
.person-chip-copy small { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.person-chip.on .person-chip-copy small { color: inherit; opacity: .75; }
.people-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.people-count { margin-left: 6px; font-weight: 500; opacity: .7; }
.people-count:empty { display: none; }
.people-actions { display: flex; flex: none; gap: 10px; }
.people-act {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.people-act:hover { text-decoration: underline; }
.task-modal .people-search { position: relative; margin-top: 8px; }
.task-modal .people-search svg {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.task-modal .people-search input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 7px 10px 7px 31px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.task-modal .people-search input:focus { border-color: var(--accent); }
.person-chip.more-chip { border-style: dashed; color: var(--accent); font-weight: 600; }
.person-chip.guest { border-style: dashed; }
.people-empty {
  display: inline-block;
  margin-top: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}

/* new direct message modal */
.new-chat-modal { width: min(460px, 100%); }
.user-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 20px 16px;
  max-height: 300px;
  overflow-y: auto;
}
.user-results-hint {
  margin: 8px 2px;
  padding: 14px 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.user-result {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .14s, border-color .14s;
}
.user-result:hover { background: var(--hover); }
.user-result:disabled { opacity: .6; cursor: progress; }
.user-result .mini-avatar { width: 38px; height: 38px; font-size: 13px; }
.user-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.user-copy b { font-size: 14px; font-weight: 600; }
.user-copy small { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chat-cta {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

/* starred chat marker */
.chat-name .star-mark {
  display: inline-flex;
  width: 12px;
  height: 12px;
  margin-left: 5px;
  color: #f5b544;
  vertical-align: -1px;
}
.chat-name .star-mark svg { width: 12px; height: 12px; }

/* Overdue task due dates */
.detail-meta > div.due-overdue,
.task-card-due.due-overdue,
.side-task .due-overdue,
.pd-task-side small.due-overdue { color: #e5484d; }
.side-task .due-overdue,
.detail-meta > div.due-overdue { font-weight: 600; }

/* Human-readable task numbers (T-001) */
.task-number {
  display: inline-flex;
  align-items: center;
  margin-right: 5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  line-height: 1.5;
  vertical-align: 1px;
  white-space: nowrap;
}

/* Project filter button inside the search box */
.search-wrap { position: relative; }
.search-filter-btn {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: background .15s ease, color .15s ease;
}
.search-filter-btn:hover { background: var(--hover); color: var(--text); }
.search-filter-btn.active { background: var(--accent-soft); color: var(--accent); }
.search-filter-btn svg { width: 18px; height: 18px; }
.search-filter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-filter-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.task-project-pop {
  top: calc(100% - 4px);
  left: 16px;
  right: 16px;
  width: auto;
  padding: 0;
  gap: 0;
  max-height: none;
  overflow: visible;
}
.project-filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  background: var(--panel);
}
.project-filter-search svg { width: 15px; height: 15px; color: var(--text-muted); flex: none; }
.project-filter-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.project-filter-search input::placeholder { color: var(--text-muted); }
.project-filter-search input::-webkit-search-cancel-button { filter: invert(.6); }
.project-filter-list {
  max-height: min(280px, 45vh);
  overflow-y: auto;
  padding: 6px;
}
.task-project-pop .menu-item.active { background: var(--accent-soft); color: var(--accent); }
.project-filter-empty {
  margin: 0;
  padding: 12px 10px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Project membership hint in the task editor */
.task-project-hint {
  margin: -4px 24px 2px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Voided records stay visible but muted */
.side-task.voided .status-dot { border-color: #f15c6d; background: #f15c6d; }
.side-task.voided .status-dot::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 6px;
  width: 6px;
  height: 1.5px;
  border-radius: 1px;
  background: #fff;
}
.side-task.voided b { color: var(--text-muted); }

/* ============================================================
   Checklists / punch lists on tasks
   ============================================================ */
.checklists-section {
  margin: 14px 16px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.checklists-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.checklists-section .checklist-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}
.checklist-card {
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
}
.checklist-card:last-child { border-bottom: 0; }
.checklist-card.checklist-done { opacity: .75; }
.checklist-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  cursor: pointer;
}
.checklist-header .checklist-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.checklist-header .checklist-pct {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.checklist-header .icon-btn { flex: none; opacity: .55; }
.checklist-header .icon-btn:hover { opacity: 1; }
.checklist-progress {
  height: 6px;
  background: var(--panel-2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.checklist-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 250ms ease;
}
.checklist-items {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.checklist-item.done .checklist-item-text {
  color: var(--text-muted);
  text-decoration: line-through;
}
.checklist-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.checklist-item-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.checklist-done-by {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}
.checklist-checkbox {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.checklist-item .icon-btn {
  flex: none;
  opacity: 0;
  margin-left: 6px;
}
.checklist-item:hover .icon-btn { opacity: .55; }
.checklist-add {
  display: flex;
  gap: 6px;
  padding: 6px 0 10px;
  border-top: 1px solid var(--border-soft);
}
.checklist-add input.checklist-new-item {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
}
.checklist-add-card {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border-soft);
}
.checklist-add-card input.checklist-new-title {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
}
.checklist-add-card .ghost-btn { flex: none; }

/* ---------- chat right-click menu ---------- */
.context-menu {
  position: fixed;
  z-index: 420;
  min-width: 208px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: modalIn .12s ease;
}
.context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.context-item:hover { background: var(--hover); }
.context-item.danger { color: #e0655a; }
.context-item.danger:hover { background: rgba(224, 101, 90, .12); }
.context-item.danger svg { color: #e0655a; }
.context-item svg { width: 16px; height: 16px; flex: none; color: var(--text-muted); }
.context-item .ctx-dot {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-grid;
  place-items: center;
}
.context-item .ctx-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* The per-message menu hugs its labels and floats with a softer shadow. */
#msgMenu {
  min-width: 158px;
  width: max-content;
  max-width: 240px;
  padding: 5px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .10);
}
#msgMenu .context-item {
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}
#msgMenu .context-item svg { width: 15px; height: 15px; }

/* ---------- forward message picker ---------- */
.forward-modal { width: min(440px, 94vw); max-height: min(82vh, 700px); }
.forward-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 18px 8px;
  padding: 9px 11px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
}
.forward-preview svg { width: 15px; height: 15px; flex: none; color: var(--accent); }
.forward-preview span { overflow: hidden; text-overflow: ellipsis; }
.forward-list {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 4px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.forward-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.forward-row:hover { background: var(--hover); }
.forward-row.selected { background: var(--active, var(--hover)); }
.forward-row .avatar { flex: none; }
.forward-row-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.forward-row-copy b {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.forward-row-copy small {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.forward-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: transparent;
}
.forward-row.selected .forward-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.forward-check svg { width: 13px; height: 13px; }

/* ---------- archived view row ---------- */
.archived-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.archived-row:hover { background: var(--hover); }
.archived-row svg { width: 17px; height: 17px; flex: none; color: var(--text-muted); }
.archived-row .arch-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
}
.archived-row.active { color: var(--accent); }
.archived-row.active svg { color: var(--accent); }

/* ---------- group create / info ---------- */
.group-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 20px 10px;
}
.group-empty-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 12.5px;
}
.group-chip .mini-avatar { width: 22px; height: 22px; font-size: 9px; }
.group-chip button {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.group-chip button:hover { background: var(--hover); color: var(--text); }
.group-chip button svg { width: 12px; height: 12px; }
.group-user-results { max-height: 220px; }

.group-info-modal { width: min(500px, 100%); }
.group-info-head { align-items: flex-start; }
.group-info-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.group-info-modal .group-info-avatar {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #00a884, #006b56);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: normal;
}
.group-info-modal .group-info-avatar.group-avatar {
  background: linear-gradient(135deg, #667781, #4a5a63);
  color: #fff;
}
.group-info-modal .group-info-avatar.group-avatar svg { width: 1.15em; height: 1.15em; display: block; }
/* Editable conversation photo: the avatar doubles as a button once the viewer
   can manage it, with a small camera badge as the affordance. */
.group-avatar-wrap { position: relative; display: inline-grid; flex: none; }
.group-avatar-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  color: inherit;
  font: inherit;
  position: relative;
  cursor: default;
}
button.group-avatar-btn { cursor: pointer; }
button.group-avatar-btn:hover .group-info-avatar { filter: brightness(1.06); }
button.group-avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.group-avatar-edit {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--panel);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  pointer-events: none;
}
.group-avatar-edit svg { width: 11px; height: 11px; display: block; }
.group-info-modal .group-info-title h2 { margin: 3px 0 2px; }
.group-info-modal .group-info-title p { margin: 0; font-size: 12px; color: var(--text-muted); }
.group-member-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 14px 12px;
  max-height: 320px;
  overflow-y: auto;
}
.group-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 9px;
}
.group-member:hover { background: var(--hover); }
.group-member .mini-avatar { width: 36px; height: 36px; font-size: 12px; }
.gm-copy {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.gm-copy b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-copy small { font-size: 11.5px; color: var(--text-muted); }
.gm-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.gm-action {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.gm-action:hover { border-color: var(--accent); color: var(--accent); }
.gm-action.danger:hover { border-color: #e0655a; color: #e0655a; }

/* 1:1 contact card inside the conversation info sheet. */
.contact-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  overflow: hidden;
}
.contact-loading,
.contact-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.contact-loading svg { width: 15px; height: 15px; flex: none; }
.contact-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
}
.contact-row:first-child { border-top: 0; }
.contact-icon {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  color: var(--accent);
}
.contact-icon svg { width: 18px; height: 18px; display: block; }
.contact-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.contact-copy small {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.contact-copy b,
.contact-copy a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.contact-copy a:hover { color: var(--accent); text-decoration: underline; }
.group-add-block { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px; }
.group-add-block .field { margin-bottom: 6px; }
.group-add-block .user-results { margin: 0 20px 12px; }

/* ---------- profile & settings ---------- */
.profile-modal { width: min(460px, 100%); }
.profile-head { align-items: center; }
.profile-head .profile-avatar {
  width: 54px;
  height: 54px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #006b56);
  color: #fff;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: normal;
}
.profile-head-copy { flex: 1; min-width: 0; }
.profile-head-copy h2 { margin: 3px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-head-copy p { margin: 0; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-form { margin: 0; }
.profile-form .field:first-child { padding-top: 2px; }
.profile-subhead {
  margin: 0;
  padding: 0 20px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.profile-divider { height: 1px; background: var(--border); margin: 4px 0 16px; }
.profile-form-actions { display: flex; justify-content: flex-end; padding: 0 20px 16px; }
.profile-form-actions .primary {
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.profile-form-actions .primary:hover { background: #06b78f; }
.profile-form-actions .primary:disabled { opacity: .45; cursor: not-allowed; }
.form-error {
  margin: 0 20px 12px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(241, 92, 109, .12);
  border: 1px solid rgba(241, 92, 109, .4);
  color: #f18b96;
  font-size: 12.5px;
  line-height: 1.4;
}
.profile-pref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 18px;
}
.profile-pref b { display: block; font-size: 13.5px; font-weight: 600; }
.profile-pref small { font-size: 11.5px; color: var(--text-muted); }
.profile-pref button {
  flex: none;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.profile-pref button:hover { border-color: var(--accent); color: var(--accent); }

/* Incoming-tone picker in the profile modal. */
.tone-picker { display: flex; align-items: center; gap: 8px; flex: none; }
.profile-pref .tone-picker select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  max-width: 150px;
}
.profile-pref .tone-picker select:hover { border-color: var(--accent); }
.profile-pref .tone-preview {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
}
.profile-pref .tone-preview svg { width: 15px; height: 15px; display: block; }


/* profile modal: password form is collapsed until requested */
.profile-password-details { margin: 0 0 4px; }
.profile-password-details > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}
.profile-password-details > summary::-webkit-details-marker { display: none; }
.profile-password-details > summary:hover { border-color: var(--accent); color: var(--accent); }
.profile-password-details[open] > summary { margin-bottom: 12px; }
/* ---------- departments (super-admin manager in the profile modal) ---------- */
.profile-depts { padding: 0 20px 4px; }
.profile-depts .profile-subhead { padding: 0 0 8px; }
.profile-depts .profile-subhead em {
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  font-weight: 600;
}
.dept-hint { margin: 0 0 10px; font-size: 11.5px; color: var(--text-muted); }
.dept-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}
.dept-chip button {
  display: inline-flex;
  border: 0;
  background: none;
  color: var(--text-muted);
  padding: 1px;
  cursor: pointer;
}
.dept-chip button svg { width: 12px; height: 12px; }
.dept-chip button:hover { color: #e5484d; }
.dept-empty { font-size: 11.5px; color: var(--text-muted); opacity: .8; }
.dept-add { display: flex; gap: 8px; margin-top: 12px; }
.dept-add input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.dept-add input:focus { border-color: var(--accent); }
.dept-add .primary {
  flex: none;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.dept-add .primary:hover { background: #06b78f; }
.dept-add .primary:disabled { opacity: .45; cursor: not-allowed; }
.menu-profile { align-items: center; gap: 11px; padding: 8px 11px; }
.menu-profile-avatar {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #006b56);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.menu-profile-copy { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.menu-profile-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-profile-email { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Uploaded profile pictures fill their round avatar holder. Absolutely
   positioned so the image stays square — and therefore circular — regardless of
   the grid/flex sizing of the holder (percentage height can resolve oddly in a
   centred grid item and leave the photo oval). */
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.avatar,
.mini-avatar,
.stack-av,
.profile-avatar,
.menu-profile-avatar {
  position: relative;
}
.profile-photo-row {
  display: flex;
  gap: 8px;
  padding: 0 20px 16px;
}
.profile-photo-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.profile-photo-btn:hover { border-color: var(--accent); color: var(--accent); }
.profile-photo-btn.danger { color: #f15c6d; }
.profile-photo-btn.danger:hover { border-color: #f15c6d; color: #f15c6d; }
.profile-photo-btn:disabled { opacity: .5; cursor: not-allowed; }

.task-readonly {
  margin: 0 20px 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}
.task-readonly b { font-size: 13.5px; }
.task-readonly p { margin: 5px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.attach-field { padding-bottom: 14px !important; }
/* Attachment pickers in create/edit popups sit in a soft gray rounded box. */
.attach-box { background: var(--attach-bg); }
.task-modal .field.attach-field.attach-box {
  margin: 0 20px 14px;
  padding: 12px 14px !important;
  border-radius: 12px;
}
.rfi-form .rfi-form-section.attach-box {
  margin: 14px 0;
  padding: 12px 14px;
  border-top: 0;
  border-radius: 12px;
}
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11.5px;
}
.attach-chip.editable { background: var(--input-bg); }
.attach-chip-icon { display: inline-flex; flex: none; color: var(--accent); }
.attach-chip-icon svg { width: 14px; height: 14px; }
.attach-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip em { font-style: normal; opacity: .6; font-size: 10px; }
.attach-chip button {
  display: inline-flex;
  flex: none;
  border: 0;
  background: none;
  color: var(--text-muted);
  padding: 1px;
  cursor: pointer;
}
.attach-chip button svg { width: 12px; height: 12px; }
.attach-chip button:hover { color: #e5484d; }
.attach-empty { font-size: 11.5px; color: var(--text-muted); opacity: .8; }
.attach-chip-copy { display: flex; flex-direction: column; min-width: 0; max-width: 200px; }
.attach-chip-copy .attach-chip-name { font-size: 12px; }
.attach-chip-meta { margin-top: 1px; font-size: 10px; color: var(--text-muted); }
.attach-thumb {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
}
.attach-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.attach-thumb.is-doc { background: #fff; }
.attach-thumb.is-doc img { object-position: top center; }
.attach-chip .attach-type.doc-icon {
  flex: none;
  width: 30px;
  height: 34px;
  border-radius: 5px;
  font-size: 8px;
  letter-spacing: .3px;
}
button.attach-chip.clickable { text-align: left; }
.attach-add { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 11px;
  cursor: pointer;
}
.ghost-btn-icon { display: inline-flex; }
.ghost-btn-icon svg { width: 14px; height: 14px; }
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

/* task detail */
.task-modal.task-detail { width: min(620px, 100%); max-height: min(92dvh, 800px); }
.task-modal.task-detail > header {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 22px 28px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.task-modal.task-detail h2 { font-size: 20px; line-height: 1.3; }
.stage-track {
  display: flex;
  gap: 5px;
  margin: 20px 28px;
  padding: 6px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.stage-step {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  opacity: .6;
}
.stage-step.done { color: var(--accent); opacity: 1; }
.stage-step.current { background: var(--accent-soft); color: var(--accent); opacity: 1; }
.stage-step.stage-clickable { cursor: pointer; }
.stage-step.stage-clickable:hover { background: var(--hover); color: var(--text); }
.stage-step.stage-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.voided-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 28px;
  padding: 12px 14px;
  border: 1px solid rgba(241, 92, 109, .35);
  border-radius: 10px;
  background: rgba(241, 92, 109, .08);
  color: #f15c6d;
}
.voided-banner > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.voided-banner b { display: block; font-size: 12.5px; }
.voided-banner span { display: block; margin-top: 2px; font-size: 11px; color: var(--text-muted); }
.voided-banner p { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 24px;
  margin: 0 28px 24px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
}
.detail-meta > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.detail-meta span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.detail-section { padding: 0 28px 22px; }
.task-modal.task-detail .detail-section + .detail-section {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.detail-section h3 {
  margin: 0 0 10px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.detail-desc { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--text); max-width: 62ch; }
.detail-people { display: flex; flex-direction: column; gap: 10px; }
.detail-person { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.detail-person .mini-avatar { width: 24px; height: 24px; font-size: 10px; }
.detail-note { font-style: normal; font-size: 10.5px; color: var(--text-muted); opacity: .8; }
.detail-section h3 .detail-note { margin-left: 6px; text-transform: none; letter-spacing: normal; font-weight: 400; }
.detail-section .attach-list { margin-top: 0; }
.proof-box {
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel-2);
}
.proof-box.empty { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.proof-box p { margin: 10px 0; font-size: 13px; line-height: 1.6; }
.proof-by { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-muted); }
.proof-form {
  margin: 0 28px 20px;
  padding: 16px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
}
.proof-form .field-label { margin-bottom: 5px; }
.proof-form textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
}
.proof-form textarea:focus { border-color: var(--accent); }
.proof-attach-label { margin-top: 13px; }
.proof-form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.proof-form-actions button {
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.proof-form-actions button:hover { background: var(--hover); color: var(--text); }
.proof-form-actions .primary { background: var(--accent); color: #fff; }
.proof-form-actions .primary:hover { background: #06b78f; color: #fff; }
.history { display: flex; flex-direction: column; gap: 4px; }
.history-item { display: flex; gap: 11px; padding: 6px 0; }
.history-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  opacity: .65;
}
.history-item b { font-size: 12.5px; font-weight: 600; }
.h-meta { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.task-modal.task-detail footer {
  padding: 18px 28px 22px;
  border-top: 1px solid var(--border);
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
.detail-actions button { border-radius: 9px; padding: 10px 16px; }
.detail-actions .primary { background: var(--accent); color: #fff; }
.detail-actions .primary:hover { background: #06b78f; color: #fff; }

/* Right panel: task-conversation detail mode. Reuses the same <aside>, header
   and collapse control as the regular chat-task panel. */
.tasks-panel.task-mode { width: 360px; }
.tasks-panel.task-mode .tasks-header { padding: 20px 18px 14px; }
.tasks-panel.task-mode .task-stats,
.tasks-panel.task-mode .tasks-subhead,
.tasks-panel.task-mode .task-list,
.tasks-panel.task-mode .new-task { display: none; }
.task-conv-detail { display: none; flex: 1; min-height: 0; flex-direction: column; }
.tasks-panel.task-mode .task-conv-detail { display: flex; }
.task-conv-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 20px; }
.task-conv-detail .stage-track { margin: 0 18px 18px; }
.task-conv-detail .stage-step { font-size: 9.5px; padding: 7px 4px; }
.task-conv-detail .voided-banner { margin: 0 18px 18px; }
.task-conv-detail .detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 0 18px 18px;
  font-size: 12.5px;
  line-height: 1.4;
}
.task-conv-detail .detail-section { padding: 0 18px 16px; }
.task-conv-detail .detail-section + .detail-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.task-conv-detail .detail-section h3 { margin-bottom: 9px; }
.task-conv-detail .detail-desc { font-size: 13px; line-height: 1.6; }
.task-conv-detail .detail-people {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.task-conv-detail .detail-person { font-size: 12.5px; }

/* Activity is secondary, so it starts collapsed in both the detail popup and
   the right-hand task panel. */
.detail-activity > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}
.detail-activity > summary::-webkit-details-marker { display: none; }
.detail-activity > summary h3 { margin: 0; }
.detail-activity > summary:hover h3 { color: var(--text); }
.detail-activity > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.detail-chevron {
  display: flex;
  align-items: center;
  flex: none;
  color: var(--text-muted);
  transition: transform .18s ease;
}
.detail-chevron svg { width: 13px; height: 13px; }
.detail-activity[open] .detail-chevron { transform: rotate(90deg); }
.detail-activity .history { margin-top: 10px; }
.task-conv-footer {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.task-conv-footer button {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 10px;
  cursor: pointer;
}
.task-conv-footer button:hover { border-color: var(--accent); color: var(--accent); }
.task-conv-footer button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-conv-footer button.primary:hover { background: #06b78f; color: #fff; }
.task-conv-footer button.danger,
.detail-actions button.danger { color: #f15c6d; border-color: rgba(241, 92, 109, .4); }
.task-conv-footer button.danger:hover,
.detail-actions button.danger:hover { background: rgba(241, 92, 109, .1); border-color: #f15c6d; color: #f15c6d; }

@media (max-width: 560px) {
  .task-modal.task-detail > header { padding: 18px 20px 14px; }
  .task-modal.task-detail .stage-track,
  .task-modal.task-detail .voided-banner { margin: 16px 20px; }
  .task-modal.task-detail .detail-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 20px 20px;
  }
  .task-modal.task-detail .detail-section { padding: 0 20px 18px; }
  .task-modal.task-detail footer { padding: 16px 20px 18px; }
  .task-modal.task-detail .proof-form { margin: 0 20px 18px; }
}

/* ============================================================
   Responsive additions
   ============================================================ */
@media (max-width: 1180px) {
  .app.tasks-hidden .tasks-panel { display: flex; }
  .tasks-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 88vw;
    z-index: 70;
    transform: translateX(100%);
    transition: transform .24s ease;
    box-shadow: -14px 0 40px rgba(0, 0, 0, .35);
  }
  .app.tasks-open .tasks-panel { transform: none; }
  .composer-task span { display: none; }
  .composer-task { padding: 0 10px; }
}
@media (max-width: 1100px) {
  .chat-actions .hide-sm { display: none; }
}
@media (max-width: 820px) {
  .chat-panel { z-index: 30; }
  .tasks-panel { z-index: 80; width: 340px; }
  /* Bubbles may use 85% of the message column and sit close to the panel edge
     (the avatar gutter is dropped on phones, where space is tight). */
  .messages { padding: 10px 15px 16px; --avatar-slot: 0px; }
  .msg-row { --row-max: 85%; }
  /* Photos stay narrower than a text bubble; documents get extra room so the
     file name, timestamp and download button don't compete for space. */
  .msg-row.is-photo { --row-max: 70%; }
  .msg-row.is-doc { --row-max: 86%; }
  /* Voice notes share the text bubble's size. */
  .msg-row.is-voice { --row-max: 85%; }
  .msg-row.is-task { --row-max: 85%; }
  /* The row cap already bounds media; don't shrink photos and documents twice. */
  .bubble:has(.photo),
  .bubble:has(.doc) { max-width: 100%; }
  /* Touch devices: no hover, so the floating react / create-task icons are
     dropped. A press-and-hold on a bubble opens the full per-message menu. */
  .msg-hover-actions { display: none; }
  /* Long-press opens the menu; keep the native text callout out of the way. */
  .msg-row .bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .side-header { padding-left: 14px; }
  .workspace-switch { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  /* The task-clipboard button is removed on mobile; the emoji, file and voice
     icons tuck in around the message box instead of spreading to the edges. */
  .composer {
    padding: 7px 6px calc(17px + env(safe-area-inset-bottom, 0px));
    gap: 4px;
    justify-content: center;
  }
  .composer > .icon-btn { width: 38px; height: 38px; }
  .composer .input-wrap { max-width: 640px; }
  .composer-task { display: none; }
  .emoji-pop { left: 8px; right: 8px; width: auto; }
  .attach-pop { left: 48px; }
  /* The per-message menu carries every action, so let it scroll when tall. */
  #msgMenu { max-height: min(72vh, 460px); overflow-y: auto; }
}
/* iOS Safari auto-zooms the page when a focused editable control's text is
   under 16px. Enforce a 16px minimum on every field across the app — on narrow
   screens *and* on touch devices (landscape phones / iPads wider than 820px,
   where the layout breakpoint above no longer applies). The !important keeps
   this ahead of component-specific rules like .settings-field input and any
   inline font-size set from JS. */
@media (max-width: 1024px), (pointer: coarse) {
  input,
  textarea,
  select,
  [contenteditable="true"],
  [role="textbox"] {
    font-size: 16px !important;
  }
}
@media (max-width: 560px) {
  .task-modal .form-grid { grid-template-columns: 1fr; }
  .task-modal .form-grid .field:first-child { padding-bottom: 0; }
  .msg-row { --row-max: 85%; }
  .voice { min-width: 0; }
  .doc { min-width: 0; }
  .chat-title h2 { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .app.tasks-open .tasks-panel {
    transform: translateX(0) !important;
    transition: none !important;
  }
}

/* Task conversations use a real chat + a task-detail right panel. */
/* ============================================================
   Workspace — projects (minimal, Apple-inspired)
   ============================================================ */
:root[data-theme="light"] {
  --ws-bg: var(--panel);
  --ws-card: var(--panel);
  --ws-border: var(--border);
  --ws-text: var(--text);
  --ws-muted: var(--text-muted);
  --ws-accent: #54656f;
  --ws-soft: var(--active);
}
:root[data-theme="dark"] {
  --ws-bg: var(--panel);
  --ws-card: var(--panel);
  --ws-border: var(--border);
  --ws-text: var(--text);
  --ws-muted: var(--text-muted);
  --ws-accent: #8696a0;
  --ws-soft: var(--active);
}

.workspace {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  background: var(--ws-bg);
  color: var(--ws-text);
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  transform: scale(.985);
  will-change: opacity, transform;
  transition: opacity .3s ease, transform .34s cubic-bezier(.22, 1, .36, 1);
}
.workspace.is-open {
  opacity: 1;
  transform: none;
}
.workspace.is-closing {
  pointer-events: none;
}

/* content settles in as the workspace resolves (grid, dashboard, empty state) */
@keyframes wsContentIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}
.ws-main.ws-enter > * {
  animation: wsContentIn .24s cubic-bezier(.22, 1, .36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .app,
  .workspace { transition: none; }
  .ws-main.ws-enter > * { animation: none; }
}

.ws-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--header);
}
.ws-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--ws-accent);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 8px 6px 4px;
  border-radius: 8px;
  cursor: pointer;
}
.ws-back:hover { background: var(--ws-soft); }
.ws-back svg { width: 18px; height: 18px; }
.ws-bar-title { flex: 1; min-width: 0; text-align: center; }
.ws-bar-title span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--ws-muted);
}
.ws-bar-title h1 {
  margin: 1px 0 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #54656f;
  background: #54656f;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .15s ease;
}
.ws-primary:hover { opacity: .9; }
.ws-primary svg { width: 15px; height: 15px; }
.ws-ghost {
  border: 1px solid var(--ws-border);
  background: var(--ws-card);
  color: var(--ws-text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.ws-ghost:hover { background: var(--hover); border-color: color-mix(in srgb, var(--ws-border) 60%, var(--ws-accent)); }

.ws-main {
  flex: 1;
  overflow-y: auto;
  padding: 26px 22px 60px;
}
.ws-main > * { max-width: 1080px; margin-left: auto; margin-right: auto; }

.ws-empty {
  margin-top: 8vh;
  text-align: center;
  padding: 40px 20px;
}
.ws-empty h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -.3px; }
.ws-empty p { margin: 0 auto 20px; max-width: 420px; color: var(--ws-muted); font-size: 14px; line-height: 1.5; }

/* project grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}
.project-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  padding: 18px;
  background: var(--ws-card);
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.project-card:hover {
  background: var(--hover);
  border-color: color-mix(in srgb, var(--ws-border) 55%, var(--ws-accent));
}
.pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pc-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.2px; }
.pc-status, .pd-status {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ws-bg);
  color: var(--ws-muted);
  border: 1px solid var(--ws-border);
}
.pc-status.active, .pd-status.active { background: var(--ws-soft); color: var(--ws-accent); border-color: transparent; }
.pc-status.upcoming { background: rgba(255, 159, 10, .14); color: #c77700; border-color: transparent; }
.pc-status.complete { background: rgba(52, 199, 89, .14); color: #248a3d; border-color: transparent; }
:root[data-theme="dark"] .pc-status.upcoming { color: #ffb340; }
:root[data-theme="dark"] .pc-status.complete { color: #4cd964; }
.pc-address { margin: 0; font-size: 13px; color: var(--ws-muted); line-height: 1.4; }
.pc-dates { display: flex; gap: 20px; }
.pc-dates div { display: flex; flex-direction: column; gap: 2px; }
.pc-dates span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ws-muted); }
.pc-dates b { font-size: 13px; font-weight: 500; }
.pc-foot {
  display: flex;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ws-border);
  font-size: 12px;
  color: var(--ws-muted);
}
.project-card.new {
  align-items: center;
  justify-content: center;
  min-height: 180px;
  border-style: dashed;
  color: var(--ws-muted);
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
}
.pc-plus { font-size: 26px; line-height: 1; font-weight: 300; color: var(--ws-accent); }

/* project dashboard */
.pd-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.pd-head-actions { display: flex; gap: 8px; flex: none; }
.pd-address { margin: 8px 0 0; font-size: 14px; color: var(--ws-muted); }
.pd-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}
.pd-map {
  border: 1px solid var(--ws-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ws-card);
  min-height: 280px;
  display: flex;
}
.pd-map-frame { width: 100%; height: 100%; min-height: 280px; border: 0; display: block; }
.pd-map-empty {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--ws-muted);
  font-size: 13px;
}
.pd-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}
.pd-fact {
  padding: 12px 14px;
  background: var(--ws-card);
  border: 1px solid var(--ws-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pd-fact span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ws-muted); }
.pd-fact b { font-size: 16px; font-weight: 600; letter-spacing: -0.2px; }

.pd-section { margin-bottom: 26px; }
.pd-section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.pd-section-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.1px; }
.pd-section-head span { font-size: 12px; color: var(--ws-muted); }
.pd-empty {
  padding: 18px;
  border: 1px dashed var(--ws-border);
  border-radius: 10px;
  color: var(--ws-muted);
  font-size: 13px;
  text-align: center;
}
.pd-groups, .pd-tasks { display: flex; flex-direction: column; }
.pd-group {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ws-border);
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.pd-group:hover { background: var(--hover); }
.pd-group-name { flex: 1; font-weight: 500; }
.pd-chev { color: var(--ws-muted); font-size: 18px; }
.pd-task {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ws-border);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.pd-task:hover { background: var(--hover); }
.pd-task:last-child, .pd-group:last-child { border-bottom: 0; }
.pd-task-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--ws-muted);
}
.pd-task-dot.assigned { background: #8e8e93; }
.pd-task-dot.in_progress { background: #ff9f0a; }
.pd-task-dot.review { background: #0a84ff; }
.pd-task-dot.closed { background: #34c759; }
.pd-task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pd-task-main b { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-task-main small { display: flex; align-items: center; gap: 6px; color: var(--ws-muted); font-size: 12px; }
.pd-task-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pd-task-side em { font-style: normal; font-size: 11.5px; color: var(--ws-accent); font-weight: 500; }
.pd-task-side small { font-size: 12px; color: var(--ws-muted); }
.pd-closed { margin-top: 10px; font-size: 12px; color: var(--ws-muted); }

/* workspace form modals — sit above the full-screen workspace */
#projectModal, #groupModal { z-index: 450; }

/* workspace form modals */
.ws-form {
  background: var(--ws-card);
  border-color: var(--ws-border);
  color: var(--ws-text);
}.ws-form header span { color: var(--ws-muted); }
.ws-form header .icon-btn { color: var(--ws-muted); }
.ws-form header .icon-btn:hover { background: var(--ws-bg); color: var(--ws-text); }
.ws-form .field { color: var(--ws-muted); }
.ws-form .field input,
.ws-form .field select,
.ws-form .field textarea {
  background: var(--ws-bg);
  border-color: var(--ws-border);
  color: var(--ws-text);
}
.ws-form .field input:focus,
.ws-form .field select:focus { border-color: var(--ws-accent); }
.ws-form .ws-hint {
  margin: -10px 0 12px;
  font-size: 11.5px;
  color: var(--ws-muted);
  line-height: 1.4;
}
.ws-form .person-chip {
  background: var(--ws-bg);
  border-color: var(--ws-border);
  color: var(--ws-text);
}
.ws-form .person-chip.on { border-color: var(--ws-accent); color: var(--ws-accent); background: var(--ws-soft); }
.ws-form .person-chip:disabled { opacity: .5; cursor: default; }
.ws-form footer button { color: var(--ws-text); }
.ws-form footer button:hover { background: var(--ws-bg); }
.ws-form footer .primary { background: var(--ws-accent); color: #fff; }
.ws-form footer .primary:hover { background: var(--ws-accent); opacity: .9; }

/* ---------- records register ---------- */
.ws-records { max-width: 1180px; margin: 0 auto; }
.ws-records-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--ws-border);
  background: var(--ws-bg);
}
.ws-record-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ws-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  background: var(--ws-card);
  color: var(--ws-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.ws-tab:hover { background: var(--hover); color: var(--ws-text); }
.ws-tab.active { background: #54656f; border-color: #54656f; color: #fff; }
.ws-tab-count {
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--ws-muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.ws-tab.active .ws-tab-count { background: rgba(255, 255, 255, .18); color: #fff; }

.ws-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ws-search {
  flex: 1 1 240px;
  min-width: 200px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  background: var(--search-bg);
  color: var(--ws-muted);
}
.ws-search svg { width: 15px; height: 15px; flex: none; }
.ws-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ws-text);
  font: inherit;
  font-size: 13px;
}
.ws-select {
  height: 34px;
  max-width: 200px;
  padding: 0 9px;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  background: var(--ws-card);
  color: var(--ws-text);
  font: inherit;
  font-size: 12.5px;
}
.ws-filter-clear {
  height: 34px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ws-muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.ws-filter-clear:hover { background: var(--hover); color: var(--ws-text); }
.ws-report {
  height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--ws-border) 70%, var(--ws-accent));
  border-radius: 8px;
  background: transparent;
  color: var(--ws-accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ws-report:hover { background: color-mix(in srgb, var(--ws-accent) 12%, transparent); }
.ws-records-summary { margin-left: auto; color: var(--ws-muted); font-size: 12px; }

.ws-records-body { display: flex; flex-direction: column; gap: 14px; }
.ws-group {
  border: 1px solid var(--ws-border);
  border-radius: 10px;
  background: var(--ws-card);
  overflow: hidden;
}
.ws-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ws-border);
  background: var(--panel-2);
}
.ws-group-title { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; min-width: 0; }
.ws-group-title h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.1px; }
.ws-group-meta { color: var(--ws-muted); font-size: 11.5px; }
.ws-text-btn {
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ws-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ws-text-btn:hover { background: var(--hover); text-decoration: underline; }

.ws-record-list { display: flex; flex-direction: column; }
.ws-record-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto 108px 62px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--ws-border);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ws-record-row:last-child { border-bottom: 0; }
.ws-record-row:hover { background: var(--hover); }
.ws-record-type {
  justify-self: start;
  min-width: 62px;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--ws-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}
.ws-record-type.rfi { color: #0a7c66; }
.ws-record-type.submittal { color: #8a6a1f; }
.ws-record-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ws-record-main b {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-record-main small {
  color: var(--ws-muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ws-muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.ws-pill.task-in_progress,
.ws-pill.task-review { background: rgba(240, 178, 50, .14); color: #9a6a14; }
.ws-pill.task-closed { background: rgba(0, 168, 132, .13); color: #0a6b57; }
.ws-pill.task-voided { background: rgba(241, 92, 109, .12); color: #c73d4c; }
.ws-pill.rfi-open,
.ws-pill.submittal-open,
.ws-pill.change_order-open { background: rgba(84, 101, 111, .14); color: var(--ws-text); }
.ws-pill.rfi-answered,
.ws-pill.submittal-answered,
.ws-pill.change_order-answered { background: rgba(240, 178, 50, .14); color: #9a6a14; }
.ws-pill.rfi-closed,
.ws-pill.submittal-closed,
.ws-pill.change_order-closed { background: rgba(0, 168, 132, .13); color: #0a6b57; }
.ws-record-due {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 5px;
  color: var(--ws-muted);
  font-size: 12px;
  white-space: nowrap;
}
.ws-record-due svg { width: 13px; height: 13px; }
.ws-record-due.overdue { color: #d9534f; font-weight: 600; }
.ws-record-open {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid var(--ws-border);
  border-radius: 6px;
  background: var(--ws-card);
  color: var(--ws-accent);
  font-size: 12px;
  font-weight: 600;
}
.ws-record-open svg { width: 14px; height: 14px; }
.ws-record-row:hover .ws-record-open { background: var(--panel-2); }

.ws-records-empty {
  padding: 56px 20px;
  border: 1px dashed var(--ws-border);
  border-radius: 10px;
  color: var(--ws-muted);
  text-align: center;
}
.ws-records-empty h2 { margin: 0 0 6px; color: var(--ws-text); font-size: 17px; }
.ws-records-empty p { margin: 0 0 16px; font-size: 13px; }
.ws-show-more {
  align-self: center;
  margin-top: 2px;
  padding: 8px 16px;
  border: 1px solid var(--ws-border);
  border-radius: 8px;
  background: var(--ws-card);
  color: var(--ws-text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.ws-show-more:hover { background: var(--hover); }

:root[data-theme="dark"] .ws-record-type.rfi { color: #4fd1b0; }
:root[data-theme="dark"] .ws-record-type.submittal { color: #e0b95c; }
:root[data-theme="dark"] .ws-pill.task-in_progress,
:root[data-theme="dark"] .ws-pill.task-review,
:root[data-theme="dark"] .ws-pill.rfi-answered,
:root[data-theme="dark"] .ws-pill.submittal-answered,
:root[data-theme="dark"] .ws-pill.change_order-answered { color: #f0c15a; }
:root[data-theme="dark"] .ws-pill.task-closed,
:root[data-theme="dark"] .ws-pill.rfi-closed,
:root[data-theme="dark"] .ws-pill.submittal-closed,
:root[data-theme="dark"] .ws-pill.change_order-closed { color: #4fd1b0; }
:root[data-theme="dark"] .ws-pill.task-voided { color: #ff8b98; }

@media (max-width: 900px) {
  .ws-record-row { grid-template-columns: 70px minmax(0, 1fr) auto 56px; }
  .ws-record-due { display: none; }
  .ws-records-summary { width: 100%; margin-left: 0; }
}
@media (max-width: 640px) {
  .ws-record-row { grid-template-columns: 62px minmax(0, 1fr) auto; gap: 8px; }
  .ws-record-open { display: none; }
  .ws-record-type { min-width: 54px; font-size: 9px; }
  .ws-filters .ws-select { flex: 1 1 140px; max-width: none; }
  .ws-search { flex-basis: 100%; }
  .ws-group-head { align-items: flex-start; }
}

@media (max-width: 820px) {
  .ws-bar { padding: 12px 12px; gap: 8px; }
  .ws-back span { display: none; }
  .ws-main { padding: 18px 14px 50px; }
  .pd-top { grid-template-columns: 1fr; }
  .pd-map { min-height: 220px; }
  .pd-map-frame { min-height: 220px; }
  .pd-head { flex-direction: column; }
  .pd-head-actions { width: 100%; }
  .pd-head-actions .ws-ghost { flex: 1; }
}





/* ============================================================
   Workspace module register (sidebar + record table)
   ============================================================ */
.ws-shell { flex: 1; display: flex; min-height: 0; }

.ws-side {
  width: 248px;
  flex: none;
  padding: 16px 10px;
  border-right: 1px solid var(--ws-border);
  background: var(--ws-bg);
  overflow-y: auto;
}
.ws-side-label {
  padding: 2px 10px 8px;
  color: var(--ws-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ws-side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ws-muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.ws-side-item:hover { background: var(--hover); color: var(--ws-text); }
.ws-side-item.active { background: var(--active); border-color: var(--ws-border); color: var(--ws-text); }
.ws-side-icon { width: 26px; height: 26px; flex: none; display: grid; place-items: center; }
.ws-side-icon svg { width: 26px; height: 26px; display: block; }
.ws-side-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-side-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--ws-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.ws-side-item.active .ws-side-count { color: var(--ws-text); }

.ws-module-view { max-width: 1180px; margin: 0 auto; }
.ws-module-toolbar {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--ws-border);
}
.ws-record-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 110px 110px 64px;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid var(--ws-border);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--panel-2);
  color: var(--ws-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ws-records-body {
  display: block;
  border: 1px solid var(--ws-border);
  border-radius: 0 0 10px 10px;
  background: var(--ws-card);
  overflow: hidden;
}
.ws-records-body .ws-records-empty { border: 0; border-radius: 0; }
.ws-record-row {
  grid-template-columns: minmax(0, 1fr) 170px 110px 110px 64px;
  border-bottom: 1px solid var(--ws-border);
}
.ws-record-project {
  min-width: 0;
  color: var(--ws-muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-show-more { display: block; margin: 12px auto; }

@media (max-width: 900px) {
  .ws-shell { flex-direction: column; }
  .ws-side {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--ws-border);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .ws-side-label { display: none; }
  .ws-side-item { flex: 1; min-width: 130px; padding: 7px 9px; }
  .ws-side-icon, .ws-side-icon svg { width: 23px; height: 23px; }
  .ws-record-head,
  .ws-record-row { grid-template-columns: minmax(0, 1fr) auto 56px; }
  .ws-record-project,
  .ws-record-due,
  .ws-record-head span:nth-child(2),
  .ws-record-head span:nth-child(4) { display: none; }
}
@media (max-width: 640px) {
  .ws-record-head,
  .ws-record-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ws-record-open,
  .ws-record-head span:nth-child(5) { display: none; }
}

/* portfolio / project dashboard add-ons */
.pd-title { margin: 8px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -0.2px; }
.pd-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.pd-matrix-card {
  padding: 14px 16px;
  border: 1px solid var(--ws-border);
  border-radius: 10px;
  background: var(--ws-card);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pd-matrix-card span { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ws-muted); }
.pd-matrix-card b { font-size: 20px; font-weight: 600; letter-spacing: -0.2px; }
.pd-matrix-card small { font-size: 11.5px; color: var(--ws-muted); }
.pd-members-groups { display: flex; flex-direction: column; gap: 14px; }
.pd-member-group { display: flex; flex-direction: column; gap: 8px; }
.pd-member-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ws-muted);
}
.pd-members { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.pd-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ws-border);
  border-radius: 10px;
  background: var(--ws-card);
}
.pd-member b { display: block; font-size: 13.5px; }
.pd-member b em { font-style: normal; font-size: 10px; font-weight: 700; color: var(--ws-accent); margin-left: 5px; text-transform: uppercase; letter-spacing: .05em; }
.pd-member small { color: var(--ws-muted); font-size: 12px; }

/* project editor modal (create / edit project + members) */
.project-modal { width: min(780px, 100%); }
.project-modal header { align-items: flex-start; padding: 22px 26px 12px; }
.project-modal-head { min-width: 0; }
.project-modal-head h2 { margin: 0; font-size: 20px; }
.project-modal-head p { margin: 5px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.project-editor { padding: 6px 26px 0; }
.project-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; }
.project-editor-col { min-width: 0; }
.project-modal .field { padding: 0 0 14px; }
.project-modal .field input {
  margin-top: 6px;
  border-color: var(--border);
  background: var(--input-bg);
  color: var(--text);
}
.project-modal .field input:focus { border-color: var(--accent); }
.project-modal footer .primary { background: var(--accent); color: #fff; }
.project-modal footer .primary:hover { background: var(--accent); opacity: .9; }
.project-editor-hint { margin: -6px 0 14px; font-size: 11.5px; line-height: 1.45; }
.project-modal .form-grid { gap: 0 12px; }
.project-members-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.project-members-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text); }
.project-members-head span { white-space: nowrap; font-size: 11.5px; color: var(--text-muted); }
.project-member-search { margin: 10px 0 8px; }
.project-member-search input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.project-member-search input:focus { border-color: var(--accent); }
.project-member-picker {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 248px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}
.project-member-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
}
.project-member-option:hover { background: var(--hover); }
.project-member-option[hidden] { display: none; }
.project-member-option input { flex: none; width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.project-member-option.owner { cursor: default; }
.project-member-option.owner:hover { background: transparent; }
.project-member-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .01em;
}
.project-member-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.project-member-copy b { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-member-copy b em { margin-left: 6px; font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: 0; color: var(--accent); }
.project-member-copy small { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-member-empty { margin: 0; padding: 12px; font-size: 12.5px; color: var(--text-muted); text-align: center; }
.project-member-actions { display: flex; gap: 14px; margin-top: 8px; }
.project-member-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.project-member-actions button:hover { color: var(--accent); }
.project-field-error { margin: -6px 0 12px; font-size: 11.5px; line-height: 1.4; color: var(--pd-bad, #c8382f); }
.project-field-error[hidden] { display: none; }
.project-modal footer { align-items: center; justify-content: space-between; gap: 12px; padding: 14px 26px; }
.project-editor-footnote { margin: 0; font-size: 11.5px; color: var(--text-muted); }
.project-editor-actions { display: flex; gap: 8px; }

@media (max-width: 760px) {
  .project-modal { max-height: 94dvh; }
  .project-modal header { padding: 18px 18px 10px; }
  .project-editor { padding: 4px 18px 0; }
  .project-editor-grid { grid-template-columns: 1fr; gap: 4px; }
  .project-member-picker { max-height: 210px; }
  .project-modal footer { flex-wrap: wrap; }
  .project-editor-footnote { flex-basis: 100%; }
}

/* ---------- projects module: rail list + WhatsApp-style right pane ---------- */
.project-rail-new {
  display: flex;
  align-items: center;
  gap: 7px;
  width: calc(100% - 24px);
  margin: 10px 12px 6px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.project-rail-new:hover { background: var(--accent-soft); border-color: var(--accent); }
.project-rail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.project-rail-row:hover { background: var(--hover); }
.project-rail-row.active { background: var(--active); box-shadow: inset 3px 0 0 var(--accent); }
.project-rail-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.project-rail-icon svg { width: 19px; height: 19px; }
.project-rail-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.project-rail-copy b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-rail-status {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-muted);
}
.project-rail-status.active { background: var(--accent-soft); color: var(--accent); }
.project-rail-status.upcoming { background: rgba(255, 159, 10, .15); color: #c77700; }
.project-rail-status.complete { background: rgba(52, 199, 89, .15); color: #248a3d; }

.project-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  --ws-bg: var(--panel);
  --ws-card: var(--panel);
  --ws-border: var(--border);
  --ws-text: var(--text);
  --ws-muted: var(--text-muted);
  --ws-accent: var(--accent);
  --ws-soft: var(--accent-soft);
}
.project-view[hidden] { display: none; }
.project-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 30px 48px; }
.project-stage { max-width: 860px; margin: 0 auto; }
.project-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.project-toolbar-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.project-toolbar-address {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Phones slide the project detail over the rail, so it needs its own header
   with a back control; on wider screens the rail stays visible. */
.project-mobile-head { display: none; }
.project-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.project-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.project-members-block { margin-top: 4px; }
.project-members-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.project-members-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.1px; }
.project-members-head span { font-size: 12px; color: var(--text-muted); }
.project-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  background: var(--panel);
}
.project-empty .empty-logo { color: var(--accent); }
.project-empty h2 { margin: 10px 0 6px; font-size: 20px; font-weight: 600; }
.project-empty p { margin: 0 auto 18px; max-width: 380px; color: var(--text-muted); font-size: 13.5px; line-height: 1.5; }

@media (max-width: 820px) {
  .project-scroll { padding: 20px 16px 36px; }
  .project-top { grid-template-columns: 1fr; }
  .project-matrix { grid-template-columns: 1fr; }
  .project-toolbar { flex-direction: column; align-items: flex-start; }
  .project-mobile-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    padding: 8px 12px;
    background: var(--header);
    border-bottom: 1px solid var(--border);
  }
  .project-back { display: grid; flex: none; }
  .project-mobile-title {
    min-width: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ---------- project dashboard (theme-aware) ----------
 * One quiet column. Hierarchy comes from type size and spacing, not boxes;
 * the only drawn structure is the schedule bar and the project record's
 * dated rule. --pd-link is the theme accent darkened in light mode so small
 * accent text clears 4.5:1 (WhatsApp light: #00a884 on white is 3.0:1). */
.project-view {
  min-width: 0;
  --pd-warn: #a65b00;
  --pd-bad: #c8382f;
  --pd-link: color-mix(in srgb, var(--accent) 76%, #000);
}
:root[data-theme="dark"] .project-view {
  --pd-warn: #f2b45a;
  --pd-bad: #ff9b94;
  --pd-link: var(--accent);
}
.pd-dash { max-width: 760px; padding-bottom: 56px; }
.pd-dash :focus-visible { outline: 2px solid var(--pd-link); outline-offset: 2px; border-radius: 6px; }

/* Header: status, name, address. Edit sits top-right, not at the page foot. */
.pd-dash-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pd-dash-heading { min-width: 0; }
.pd-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.pd-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pd-state.is-active { color: var(--pd-link); }
.pd-state.is-upcoming { color: var(--pd-warn); }
.pd-dash-name-main { margin: 0 0 6px; font-size: 26px; line-height: 1.2; font-weight: 650; letter-spacing: -0.4px; color: var(--text); overflow-wrap: anywhere; }
.pd-dash-address { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.pd-dash-address a { color: var(--pd-link); font-weight: 600; text-decoration: none; }
.pd-dash-address a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pd-edit { flex: none; min-height: 32px; margin-top: 22px; }

/* Schedule: determinate bar, the count in words above it. */
.pd-sched { margin: 30px 0 0; }
.pd-sched-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pd-sched-label b { font-size: 15px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.pd-sched-label span { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pd-sched.is-late .pd-sched-label b { color: var(--pd-bad); }
.pd-sched.is-empty .pd-sched-label b { font-weight: 500; color: var(--text-muted); }
.pd-dash-bar { position: relative; height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.pd-dash-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }
.pd-sched.is-late .pd-dash-bar i { background: var(--pd-bad); }
.pd-dash-dates { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }

/* Sections: plain headings and generous space between them. */
.pd-block { margin-top: 48px; }
.pd-hd { margin: 0 0 4px; font-size: 18px; line-height: 1.35; font-weight: 650; letter-spacing: -0.2px; color: var(--text); }
.pd-sub { margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.pd-folds { margin-top: 8px; border-top: 1px solid var(--border); }
.pd-fold { border-bottom: 1px solid var(--border); }
.pd-fold > summary,
.pd-fold-static {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 2px;
  list-style: none;
}
.pd-fold > summary { cursor: pointer; }
.pd-fold > summary::-webkit-details-marker { display: none; }
.pd-fold-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.pd-fold-count {
  flex: none;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--pd-link);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pd-fold-chevron { flex: none; display: inline-flex; margin-left: 2px; color: var(--text-muted); transition: transform .15s ease; }
.pd-fold-chevron svg { width: 15px; height: 15px; }
.pd-fold[open] .pd-fold-chevron { transform: rotate(90deg); }
.pd-fold-body { padding: 0 0 8px; }
/* Nothing pending: the row stays for a stable layout but reads as done. */
.pd-fold-empty .pd-fold-title { font-weight: 500; color: var(--text-muted); }
.pd-fold-empty .pd-fold-count { background: transparent; color: var(--text-muted); font-weight: 500; margin-right: 25px; }
.pd-folds .pd-fold-body { padding: 0 0 10px 14px; border-left: 2px solid var(--accent-soft); margin-left: 2px; }
.pd-fold-headline { margin-top: 48px; border-bottom: 0; }
.pd-fold-headline > summary { min-height: 0; padding: 0 0 12px; }
.pd-fold-headline .pd-fold-title { font-size: 18px; font-weight: 650; letter-spacing: -0.2px; }
.pd-fold-headline .pd-fold-count { background: transparent; color: var(--text-muted); font-weight: 500; }
.pd-fold-headline .pd-fold-body { padding: 0 0 12px; }

/* Record rows: flat, the whole row opens the record. */
.pd-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 0;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.pd-fold-body > .pd-row:first-child { border-top: 0; }
.pd-row:hover .pd-row-copy b { color: var(--pd-link); }
.pd-row-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-row-copy b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-row-copy small { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-row-age { flex: none; font-size: 12.5px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.pd-row-age.late { color: var(--pd-bad); }
.pd-row-age.soon { color: var(--pd-warn); }
.pd-row-go { flex: none; display: inline-flex; color: var(--text-muted); opacity: .65; }
.pd-row:hover .pd-row-go { color: var(--pd-link); opacity: 1; }
.pd-row-go svg { width: 14px; height: 14px; }
.pd-note { margin: 0; padding: 12px 2px; font-size: 14px; line-height: 1.6; color: var(--text-muted); }

/* Recent activity */
.pd-activity { display: flex; flex-direction: column; }
.pd-activity-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 8px 0;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.pd-activity-row:first-child { border-top: 0; }
.pd-activity-row time { flex: none; width: 52px; font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pd-activity-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pd-activity-copy b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-activity-copy small { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-activity-row:hover .pd-activity-copy b { color: var(--pd-link); }

/* Members: flat rows. */
.pd-member-search {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  margin: 2px 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.pd-member-search:focus { outline: none; border-color: var(--pd-link); }
.pd-members-list { display: flex; flex-direction: column; }
.pd-member {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
.pd-member:first-child { border-top: 0; }
.pd-member[hidden] { display: none; }
.pd-member .settings-person-avatar { width: 32px; height: 32px; font-size: 11.5px; flex: none; }
.pd-member-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pd-member-copy b { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-member-copy small { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-member-act {
  flex: none;
  min-height: 32px;
  margin-left: auto;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--pd-link);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pd-member-act:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Project record: a dated ledger. Day numbers on the left, a rule joining
 * the entries, the note in body type, its source quoted beneath. */
.pr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pr-head .pd-hd { margin: 0; }
.pr-block .pd-sub { margin-top: 4px; }
.pr-add { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; }
.pr-add svg { width: 13px; height: 13px; }
.pr-list { display: flex; flex-direction: column; margin-top: 6px; }
.pr-entry { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 30px; padding: 0 0 22px; }
/* The rule: runs from each date marker down to the next entry. */
.pr-entry::before {
  content: "";
  position: absolute;
  left: 58px;
  top: 10px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}
.pr-entry:last-child::before { display: none; }
.pr-entry-main { position: relative; min-width: 0; }
.pr-entry-main::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 0 0 2px var(--accent);
}
.pr-date { display: flex; flex-direction: column; align-items: flex-end; padding-top: 1px; line-height: 1.1; }
.pr-date b { font-size: 20px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.pr-date span { margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.pr-note { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.pr-source {
  margin: 8px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--panel-2);
}
.pr-note + .pr-source { margin-top: 10px; }
.pr-entry-main > .pr-source:first-child { margin-top: 0; }
.pr-source-head { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.pr-source-head span:first-child { color: var(--text); }
.pr-source p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pr-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pr-files:empty { display: none; }
.pr-files.is-off { opacity: .4; }
.pr-entry-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin-top: 4px; }
.pr-entry-by { margin-right: auto; font-size: 12.5px; color: var(--text-muted); }
.pr-entry-by:empty { display: none; }
.pr-actions { display: contents; }
.pr-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pd-link);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pr-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.pr-link.danger { color: var(--text-muted); }
.pr-link.danger:hover { color: var(--pd-bad); }
.pr-more {
  min-height: 36px;
  margin: 0 0 0 74px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pd-link);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pr-body > .pd-note { padding-left: 2px; }

@media (max-width: 820px) {
  .pd-dash-name-main { font-size: 23px; }
  .pd-edit { margin-top: 0; }
  .pd-dash-top { flex-direction: column; align-items: flex-start; gap: 14px; }
  .pd-row-age { display: none; }
  .pr-entry { grid-template-columns: 36px minmax(0, 1fr); gap: 0 24px; }
  .pr-entry::before { left: 47px; }
  .pr-entry-main::before { left: -16px; }
  .pr-more { margin-left: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .pd-fold-chevron { transition: none; }
}
@media (prefers-contrast: more) {
  .project-view { --border: var(--text-muted); }
  .pd-fold-count { background: transparent; border: 1px solid currentColor; }
}

/* The "Add to project record" sheet. */
.pr-modal { width: min(500px, 94vw); }
.pr-modal .field textarea { min-height: 76px; }
.pr-modal-body > :not(.field) { margin-left: 24px; margin-right: 24px; }
.pr-modal-body > .pr-source-preview { margin-top: 0; margin-bottom: 14px; }
.pr-modal-body > .pr-files { margin-top: 0; margin-bottom: 14px; }
.pr-modal .field > span { display: block; }
.pr-fixed-project { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.pr-include { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.pr-include input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.pr-attach {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 7px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pr-attach:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pr-attach svg { width: 15px; height: 15px; }
.rfi-record-row { padding: 4px 0 12px; }
.rfi-record-row .rfi-text-btn svg { width: 14px; height: 14px; }
/* ---------- clickable attachment chips (buttons) ---------- */
button.attach-chip.clickable {
  font-family: inherit;
  cursor: pointer;
}
button.attach-chip.clickable:hover {
  background: var(--hover);
  color: var(--text);
}

/* ---------- attachment viewer: WhatsApp-style media view, theme-aware ---------- */
#mediaModal.modal-backdrop.media-viewer {
  --mv-bg: #fff;
  --mv-panel: #fff;
  --mv-text: #111b21;
  --mv-icon: #54656f;
  --mv-muted: #667781;
  --mv-border: #e9edef;
  --mv-hover: #e9edef;
  --mv-strip: #f7f8fa;
  --mv-thumb: #e9edef;
  --mv-arrow: #d9dbdd;
  --mv-arrow-hover: #c7c9cb;
  --mv-active: #00a884;
  padding: 0;
  background: var(--mv-bg);
  backdrop-filter: none;
  place-items: stretch;
}
:root[data-theme="dark"] #mediaModal.modal-backdrop.media-viewer {
  --mv-bg: #0b141a;
  --mv-panel: #111b21;
  --mv-text: #e9edef;
  --mv-icon: #b8c4cc;
  --mv-muted: #8696a0;
  --mv-border: #2a3942;
  --mv-hover: #202c33;
  --mv-strip: #111b21;
  --mv-thumb: #202c33;
  --mv-arrow: #2a3942;
  --mv-arrow-hover: #374851;
  --mv-active: #00a884;
}
.media-viewer .media-box {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-height: none;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--mv-panel);
  animation: none;
  overflow: hidden;
}
.media-viewer .media-topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 58px;
  padding: 10px 16px 4px;
  color: var(--mv-text);
  background: var(--mv-panel);
  border: 0;
}
.media-viewer .media-close { flex: none; color: var(--mv-icon); }
.media-viewer .media-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.media-viewer .media-topbar .icon-btn,
.media-viewer .media-actions .icon-btn { width: 34px; height: 34px; color: var(--mv-icon); }
.media-viewer .media-close svg,
.media-viewer .media-actions .icon-btn svg { width: 19px; height: 19px; }
.media-viewer .media-actions .icon-btn:hover { background: var(--mv-hover); color: var(--mv-text); }
.media-viewer .media-actions .icon-btn:disabled { opacity: .35; cursor: default; }
.media-viewer .media-actions .icon-btn:disabled:hover { background: transparent; color: var(--mv-icon); }
.media-viewer .media-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  overflow: hidden;
}
.media-viewer .media-title strong { font-size: 14px; font-weight: 600; color: var(--mv-text); }
.media-viewer .media-title small { font-size: 12px; color: var(--mv-muted); }
.media-viewer .media-count {
  flex: none;
  padding: 4px 0 6px;
  text-align: center;
  font-size: 12px;
  color: var(--mv-muted);
  background: var(--mv-panel);
  white-space: nowrap;
}

.media-viewer .media-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--mv-bg);
  touch-action: none;
}
.media-viewer .media-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}
.media-viewer .media-canvas.image { padding: 12px 96px 12px; }
.media-viewer .media-image {
  display: block;
  flex: 0 1 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  object-fit: contain;
  transform-origin: center;
  will-change: transform;
}
.media-viewer .media-canvas.video {
  padding: 12px 96px;
}
.media-viewer .media-video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
  background: #000;
}
.media-viewer .media-canvas:not(.image):not(.video) {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
}
.media-viewer .media-frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 4px;
  background: var(--mv-panel);
}
.media-viewer .media-note { padding: 8px 12px; margin: 0; font-size: 11.5px; color: var(--mv-muted); text-align: center; }
.media-viewer .media-fallback { margin: auto; text-align: center; color: var(--mv-muted); padding: 24px; }
.media-viewer .media-fallback p { margin: 4px 0; font-size: 13px; }

/* prev / next navigation arrows */
.media-viewer .media-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: .75;
  transition: opacity .15s ease, background .15s ease;
  z-index: 4;
  background: var(--mv-arrow);
  color: var(--mv-icon);
}
.media-viewer .media-nav.prev { left: 12px; }
.media-viewer .media-nav.next { right: 12px; }
.media-viewer .media-nav:hover { background: var(--mv-arrow-hover); opacity: 1; }
.media-viewer .media-nav svg { width: 22px; height: 22px; }

/* bottom filmstrip */
.media-viewer .media-thumbs {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px 10px;
  overflow-x: auto;
  background: var(--mv-strip);
  border-top: 1px solid var(--mv-border);
  scrollbar-width: thin;
}
.media-viewer .media-thumb {
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--mv-thumb);
  cursor: pointer;
  opacity: .7;
  display: grid;
  place-items: center;
  outline: 2px solid transparent;
  outline-offset: -2px;
}
.media-viewer .media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-viewer .media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-viewer .media-thumb .doc-icon { width: 28px; height: 32px; font-size: 8.5px; }
.media-viewer .media-thumb:hover { opacity: 1; }
.media-viewer .media-thumb.active { opacity: 1; outline-color: var(--mv-active); }

/* tooltips are rendered globally by 11-tooltips.js */

@media (max-width: 820px) {
  .media-viewer .media-topbar { padding: 6px 8px; min-height: 50px; }
  .media-viewer .media-title strong { font-size: 13px; }
  .media-viewer .media-topbar .icon-btn,
  .media-viewer .media-actions .icon-btn { width: 32px; height: 32px; }
  .media-viewer .media-canvas.image { padding: 8px 12px; }
  .media-viewer .media-nav { width: 34px; height: 34px; }
  .media-viewer .media-nav svg { width: 18px; height: 18px; }
  .media-viewer .media-thumbs {
    justify-content: flex-start;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .media-viewer .media-thumb { width: 44px; height: 44px; }
}

/* ---------- video messages (same snug bubble treatment as photos) ---------- */
.bubble:has(.video-bubble) { padding: 4px 4px 6px; max-width: min(74%, 340px); }
.video-bubble { width: 100%; max-width: 100%; }
.video-bubble .chat-video {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 12px;
  background: #000;
}
.video-bubble .caption { margin: 0; padding: 3px 6px 0; }
.video-bubble > .meta { padding: 1px 6px 0; }

/* ---------- photo album (multiple photos in one message) ---------- */
.bubble:has(.gallery) { padding: 4px 4px 6px; max-width: min(86%, 400px); }
.gallery {
  display: grid;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
}
.gallery-tile {
  position: relative;
  overflow: hidden;
  background: #0b141a;
  cursor: pointer;
}
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gallery-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
}
.gallery.n2 { grid-template-columns: 1fr 1fr; }
.gallery.n2 .gallery-tile { height: auto; aspect-ratio: 1 / 1; }
.gallery.n3 { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
.gallery.n3 .gallery-tile { height: auto; aspect-ratio: 1 / 1; }
.gallery.n3 .gallery-tile:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.gallery.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
.gallery.n4 .gallery-tile { height: auto; aspect-ratio: 1 / 1; }

/* ---------- attachment compose (WhatsApp-style review before sending) ---------- */
.compose-viewer { padding: 0; background: var(--panel); backdrop-filter: none; }
/* Beat theme-level .modal-backdrop backgrounds/blur (these load after this file). */
:root[data-theme-style] .modal-backdrop.compose-viewer {
  background: var(--panel);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  padding: 0;
}
.compose-sheet {
  width: 100%;
  height: 100dvh;
  max-height: none;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
.compose-topbar {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}
.compose-topbar-title { font-size: 13px; font-weight: 600; color: var(--text); }
.compose-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}
.compose-stage-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  box-shadow: 0 3px 18px rgba(0, 0, 0, .14);
}
.compose-stage-doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: min(420px, 90vw);
  text-align: center;
}
.compose-stage-doc b { font-size: 15px; font-weight: 600; word-break: break-word; }
.compose-stage-doc small { font-size: 12px; color: var(--text-muted); }
.compose-tray { flex: none; padding: 0 20px 18px; }
.compose-caption { padding: 0; }
.compose-caption input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.compose-caption input:focus { outline: none; border-color: var(--accent); }
.compose-filmstrip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-right: 64px;
}
.compose-strip-item { position: relative; width: 56px; height: 56px; }
.compose-strip-btn {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  cursor: pointer;
}
.compose-strip-item.active .compose-strip-btn { border-color: var(--accent); }
.compose-strip-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.compose-strip-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.compose-strip-remove svg { width: 10px; height: 10px; }
.compose-add-tile {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.compose-add-tile:hover { color: var(--accent); border-color: var(--accent); }
.compose-add-tile svg { width: 22px; height: 22px; }
.compose-send {
  position: absolute;
  right: 22px;
  bottom: 18px;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  cursor: pointer;
}
.compose-send svg { width: 24px; height: 24px; }
.compose-send:hover { filter: brightness(1.06); }
.compose-send:disabled { opacity: .6; cursor: default; }

@media (max-width: 820px) {
  .compose-viewer { padding: 0; }
  .compose-stage { padding: 12px; }
  .compose-tray { padding: 0 12px 14px; }
  .compose-filmstrip { padding-right: 0; padding-bottom: 58px; }
  .compose-send { right: 14px; bottom: 12px; width: 50px; height: 50px; }
}

/* ---------- attachment upload progress (optimistic sends) ---------- */
.gallery-wrap { position: relative; display: block; width: 100%; max-width: 100%; }
.photo.pending .photo-img { filter: brightness(.72); }

.upload-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 20, 26, .35);
}
.upload-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) var(--p, 0%), rgba(255, 255, 255, .28) 0);
  position: relative;
}
.upload-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(11, 20, 26, .82);
}
.upload-ring span {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.upload-ring.sending { animation: spinRing 1s linear infinite; }
@keyframes spinRing { to { transform: rotate(360deg); } }

.upload-cancel {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.upload-cancel svg { width: 15px; height: 15px; }
.upload-cancel:hover { background: #e5484d; }

.upload-overlay.failed {
  flex-direction: column;
  gap: 6px;
  border: 0;
  background: rgba(11, 20, 26, .62);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}
.upload-alert {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e5484d;
  color: #fff;
  display: grid;
  place-items: center;
}
.upload-alert svg { width: 18px; height: 18px; }
.upload-retry { font-size: 12px; font-weight: 600; }

/* pending clock / failure tick */
.meta.pending { color: var(--text-muted); }
.pending-tick { display: inline-flex; align-items: center; margin-left: 4px; vertical-align: middle; }
.pending-tick svg { width: 14px; height: 14px; }
.pending-tick.failed { color: #e5484d; }

/* document upload row */
.doc.pending { min-width: 258px; }
.doc-progress {
  display: block;
  height: 3px;
  margin-top: 5px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.doc-progress i { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }
.doc-status.failed { color: #e5484d; }
.doc-retry {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border: 0;
  border-radius: 7px;
  background: rgba(229, 72, 77, .14);
  color: #e5484d;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.doc-retry svg { width: 14px; height: 14px; }
.doc-retry:hover { background: rgba(229, 72, 77, .22); }
.doc-cancel {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.doc-cancel svg { width: 16px; height: 16px; }
.doc-cancel:hover { background: var(--hover); color: #e5484d; }

/* ---------- "what can I upload" hint ---------- */
.attach-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
  opacity: .85;
}
.compose-hint { padding: 0 16px 12px; }
.compose-hint .attach-hint { margin: 0; }
/* In the narrow attach menu the hint needs a little more room and a divider. */
.attach-pop { width: 218px; }
.attach-pop .attach-hint {
  margin: 5px 3px 1px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  line-height: 1.4;
}
/* Avatar / logo picker notes sit directly under the row they describe. */
.profile-photo-row + .attach-hint { padding: 0 20px; margin: -8px 0 10px; }
.settings-avatar-row + .attach-hint { margin-top: 0; }
.settings-company-logo + .attach-hint { margin-top: -10px; }
.group-info-head + .attach-hint { margin: 0 14px 8px; }

/* ---------- drag & drop upload overlay ---------- */
.drop-overlay {
  position: fixed;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 20, 26, .22);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease;
  pointer-events: none;
}
.drop-overlay.show { opacity: 1; visibility: visible; }
.drop-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: min(380px, 92%);
  padding: 22px 26px;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  text-align: center;
  box-shadow: var(--shadow);
}
.drop-overlay-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 2px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--accent);
}
.drop-overlay-icon svg { width: 24px; height: 24px; }
.drop-overlay-card b { font-size: 14px; font-weight: 600; }
.drop-overlay-card span:last-child { font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
@media (max-width: 820px) {
  .drop-overlay-card { padding: 18px 18px; }
}

/* ============================================================
   Task conversations
   A task owns a real chat; its avatar is a status-coloured
   message-bubble-with-check instead of initials, and its title
   mirrors the task title.
   ============================================================ */
.task-avatar.assigned    { background: linear-gradient(135deg, #6f8290, #46545e); }
.task-avatar.in_progress { background: linear-gradient(135deg, #f0b232, #c9871a); }
.task-avatar.review      { background: linear-gradient(135deg, #8f7cf6, #6a54e8); }
.task-avatar.closed      { background: linear-gradient(135deg, #00a884, #006b56); }
.task-avatar.voided      { background: linear-gradient(135deg, #f15c6d, #b53645); }
.avatar.task-avatar,
.group-info-modal .group-info-avatar.task-avatar {
  color: #fff;
  display: grid;
  place-items: center;
}
.task-avatar svg { width: 1.15em; height: 1.15em; display: block; }

/* Header status line for a task conversation. */
.chat-title p.task-status-line { color: var(--text-muted); font-weight: 500; }

/* Task card footer link into the discussion. */
.task-conv-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.task-conv-link:hover { text-decoration: underline; }
.task-conv-link svg { width: 12px; height: 12px; }

/* Task detail: "Open conversation" action button. */
.detail-actions .conv-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.detail-actions .conv-action:hover { border-color: var(--accent); color: var(--accent); }
.detail-actions .conv-action svg { width: 15px; height: 15px; }

/* Task conversation "info" modal (read-only membership). */
.task-conv-modal .group-info-title > div > span { color: var(--accent); }
.task-conv-modal .ws-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0 20px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.task-conv-modal .ws-hint svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
/* Regular (non-managed) group info sheets: the shared .ws-hint rule has no
   horizontal inset, so its text ran right up against the modal edge. */
.group-info-modal:not(.task-conv-modal) .ws-hint {
  margin-left: 20px;
  margin-right: 20px;
}

/* ---------- create (plus) menu ---------- */
.new-menu { right: 12px; }
.new-menu .menu-item svg { color: var(--accent); }

/* ---------- task name ⇅ description mover ---------- */
.field-swap-row {
  display: flex;
  justify-content: center;
  padding: 0 20px;
  margin: -6px 0 6px;
}
.field-swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text-muted);
  cursor: pointer;
}
.field-swap svg { width: 16px; height: 16px; }
.field-swap:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   Left icon rail  (WhatsApp-style; Chats/Tasks/RFIs/Drive
   are the field-workspace modules)
   ============================================================ */
.rail {
  flex: none;
  width: var(--rail-w, 66px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0 12px;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  position: relative;
  z-index: 3;
  transition: width .18s ease;
}
.rail-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.rail-spacer { flex: 1; }

/* Every module shares one highlight hue — the Chats green — so the selected
   tile still reads as "you are here" without a rainbow of per-module tints. */
.rail-btn[data-rail] { --mod: #00a884; }

/* Projects and Files are a separate group: they hold the company's records
   rather than the day-to-day conversation flow. */
.rail-sep {
  flex: none;
  width: 28px;
  height: 1px;
  margin: 7px 0 5px;
  border-radius: 1px;
  background: var(--border);
  background: color-mix(in srgb, var(--text-muted) 55%, transparent);
}
:root.rail-expanded .rail-sep { width: auto; margin: 7px 8px 5px; }

.rail-btn {
  --mod: #00a884;
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.rail-btn svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.6;
  transition: transform .12s ease;
}
.rail-btn:hover { background: var(--hover); color: var(--text); }
/* Modules also get a hint of their own colour on hover, matching the tinted
   selected state (Settings and the expand toggle stay neutral). */
.rail-btn[data-rail]:hover {
  background: var(--hover);
  background: color-mix(in srgb, var(--mod) 9%, transparent);
  color: color-mix(in srgb, var(--mod) 80%, var(--text));
}
.rail-btn.active {
  background: var(--accent-soft);            /* fallback if color-mix is unsupported */
  color: var(--accent);
  background: color-mix(in srgb, var(--mod) 13%, transparent);
  color: color-mix(in srgb, var(--mod) 84%, var(--text));
}
/* Press feedback; the expand toggle keeps its rotation. */
.rail-btn:not(.rail-toggle):active svg { transform: scale(.96); }
.rail-btn.rail-soon:hover { color: var(--accent); }
/* Amber dot when an RFI/submittal was sent back to this user. */
.rail-btn.has-returned::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f0b232;
  box-shadow: 0 0 0 2px var(--panel-2);
}
.rail-me { border-radius: 50%; }

/* Geometry is identical in both states so the icons never move: the rail keeps
   its 66px-padded centre line (button edge 9px, icon centre 33px) and buttons
   keep their 48px height and 29px icons. Only the row width and labels change. */
.rail-label {
  display: none;
  min-width: 0;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-toggle { width: 48px; height: 40px; margin-top: 2px; border-radius: 14px; }
.rail-toggle svg { width: 18px; height: 18px; margin: 0 2.5px; stroke-width: 2; transition: transform .18s ease; }
.rail-toggle-icon { transform: rotate(180deg); }
:root.rail-expanded .rail-toggle-icon { transform: none; }

:root.rail-expanded .rail { align-items: stretch; padding-left: 8.5px; padding-right: 8.5px; }
:root.rail-expanded .rail-group { align-items: stretch; }
:root.rail-expanded .rail-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 10px 0 12.5px;
  border-radius: 14px;
}
:root.rail-expanded .rail-btn svg { flex: none; }
:root.rail-expanded .rail-btn .rail-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .01em;
}
:root.rail-expanded .rail-btn.rail-me { border-radius: 14px; }
:root.rail-expanded .rail-count {
  position: static;
  margin-left: auto;
  box-shadow: none;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
}
:root.rail-expanded .rail-toggle { width: 100%; justify-content: flex-start; padding: 0 10px 0 12.5px; }
:root.rail-expanded .rail-toggle .rail-label { display: block; font-size: 12.5px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .rail,
  .rail-btn svg,
  .rail-toggle svg { transition: none; }
  .rail-btn:not(.rail-toggle):active svg { transform: none; }
}

/* On desktop the whole sidebar scrolls, not just the list. The search box and
   filter pills therefore travel with the rows: scrolling down gives their
   space back to conversation names, and scrolling back to the top brings them
   straight back. Only the header stays pinned. */
@media (min-width: 821px) {
  .sidebar {
    overflow-y: auto;
    overflow-x: hidden;
    /* Reserve the scrollbar track up front so the content width (and the
       rail's apparent width) never shifts when rows start or stop overflowing. */
    scrollbar-gutter: stable;
  }
  .side-header {
    position: sticky;
    top: 0;
    z-index: 7;
  }
  .search-wrap,
  .filters { flex: none; }
  .chat-list {
    flex: none;
    overflow: visible;
  }
}

/* On small screens the rail becomes a floating bottom navigation bar — a
   rounded, glassmorphic capsule pinned above the home indicator, inset from
   the screen edges the way a native tab bar floats. The buttons and their
   data-rail wiring are unchanged; only the axis and the chrome differ.

   True iOS "Liquid Glass" (iOS 26) is an OS-level material with refraction
   that the web cannot reproduce, so this is the closest web equivalent: a
   frosted, saturated translucent layer with a soft top sheen. */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  /* The whole sidebar is the scroll surface on phones, so the brand header
     stays pinned while the search box and filter pills scroll away. */
  .sidebar {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
  .side-header {
    position: sticky;
    top: 0;
    z-index: 7;
    height: calc(68px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }
  /* Keep the search box and pill rows at their natural height — otherwise the
     scrolling flex column shrinks them (and clips the pills) instead of
     overflowing. */
  .search-wrap,
  .filters { flex: none; }
  /* The chat header shares the top of the screen (standalone PWA overlaps the
     status bar), so it clears the notch too. */
  .chat-header {
    height: calc(68px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }

  /* Once the top controls are gone, the header names the chat scope. Module
     naming is global (03-additions.css) and no longer waits for a scroll. */
  .sidebar.list-scrolled .brand-copy h1,
  .sidebar.list-scrolled .brand-copy [data-company-name] { display: none; }
  .sidebar.list-scrolled .header-module-name {
    display: block;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--text);
    animation: headerModuleIn .18s ease;
  }

  .rail {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    /* Float 15px above the bottom edge, plus the home-indicator safe area so
       the capsule clears the iOS gesture bar. */
    bottom: max(15px, calc(15px + env(safe-area-inset-bottom)));
    width: auto;
    height: auto;
    flex: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    /* Frosted glass: translucent panel + blur + a faint top highlight. */
    background: var(--panel-2);
    background: color-mix(in srgb, var(--panel-2) 24%, transparent);
    -webkit-backdrop-filter: blur(15px) saturate(190%);
    backdrop-filter: blur(15px) saturate(190%);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .34),
      0 2px 8px rgba(0, 0, 0, .18),
      inset 0 1px 0 rgba(255, 255, 255, .10);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    z-index: 25;
    transition: transform .24s cubic-bezier(.22, 1, .36, 1), opacity .18s ease;
  }
  /* Opaque fallback where the frosted layer isn't supported. */
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .rail { background: var(--panel-2); }
  }
  .rail::-webkit-scrollbar { display: none; }
  /* YouTube-style: swipe up through the feed and the bar slides away; swipe
     back down and it slides straight back in. JS toggles `rail-hidden`. */
  .rail.rail-hidden {
    transform: translateY(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
  }
  .rail-group { flex-direction: row; align-items: center; gap: 8px; width: auto; flex: none; }
  .rail-spacer { display: none; }
  .rail-sep { flex: none; width: 1px; height: 32px; margin: 0 8px; }
  .rail-btn { flex: none; width: 56px; height: 56px; }
  .rail-btn svg { width: 30px; height: 30px; }
  .rail-btn.active { border-radius: 16px; }
  .rail-btn.has-returned::after { top: 9px; left: 9px; }
  .rail-toggle { display: none; }
  .rail-label { display: none; }

  /* The sidebar owns the scroll, so the list lays out at its natural height. */
  .chat-list {
    flex: none;
    overflow: visible;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  /* If the rail was expanded on a wider screen, keep it icon-only here. */
  :root.rail-expanded .rail { align-items: center; justify-content: space-between; padding: 8px 12px; }
  :root.rail-expanded .rail-group { align-items: center; }
  :root.rail-expanded .rail-btn {
    display: grid;
    justify-content: center;
    width: 56px;
    padding: 0;
    border-radius: 16px;
  }
  :root.rail-expanded .rail-btn .rail-label { display: none; }
  :root.rail-expanded .rail-sep { width: 1px; height: 32px; margin: 0 8px; }
}

/* ============================================================
   Google Drive file manager
   Full-screen browser layered beside the icon rail. It shares the
   app's theme tokens so light/dark mode stays consistent.
   ============================================================ */

.drive-app {
  position: fixed;
  inset: 0 0 0 var(--rail-w, 66px); /* leave the icon rail visible */
  z-index: 40;
  display: flex;
  background: var(--panel);
  color: var(--text);
  animation: driveIn .18s ease;
}
@keyframes driveIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.drive-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
}

/* ---------- top bar ---------- */
.drive-head {
  flex: none;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 20px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}
.drive-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
}
.drive-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--text-muted);
  flex: none;
}
.drive-brand-mark svg { width: 22px; height: 22px; }
.drive-brand-copy b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.drive-brand-copy small { display: block; margin-top: 1px; font-size: 10.5px; color: var(--text-muted); }

.drive-search {
  flex: 1;
  max-width: 680px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--search-bg);
  color: var(--text-muted);
  transition: border-color .15s ease, background .15s ease;
}
.drive-search:focus-within { border-color: var(--text-muted); background: var(--input-bg); }
.drive-search svg { width: 18px; height: 18px; flex: none; }
.drive-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}
.drive-search input::placeholder { color: var(--text-muted); }

.drive-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.drive-quota {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- body ---------- */
.drive-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

/* ---------- left nav ---------- */
.drive-nav {
  flex: none;
  width: 228px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px 12px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
}
.drive-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .13s ease, color .13s ease;
}
.drive-nav-item:hover { background: var(--hover); color: var(--text); }
.drive-nav-item.active { background: var(--active); color: var(--text); font-weight: 600; }
.drive-nav-ico { display: inline-flex; width: 19px; height: 19px; flex: none; }
.drive-nav-ico svg { width: 19px; height: 19px; }
.drive-nav-sep { height: 1px; margin: 8px 12px; background: var(--border); }
.drive-nav-spacer { flex: 1; min-height: 8px; }
.drive-nav-label {
  padding: 8px 12px 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.drive-nav-account {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.drive-nav-account:hover { border-color: var(--text-muted); }
.drive-nav-account-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: none;
}
.drive-nav-account-copy { flex: 1; min-width: 0; }
.drive-nav-account-copy b,
.drive-nav-account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-nav-account-copy b { font-size: 11.5px; font-weight: 600; }
.drive-nav-account-copy small { font-size: 10px; color: var(--text-muted); }
.drive-nav-account > svg { width: 14px; height: 14px; color: var(--text-muted); flex: none; }

/* ---------- main ---------- */
.drive-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.drive-toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.drive-crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.drive-crumbs::-webkit-scrollbar { display: none; }
.drive-crumb {
  max-width: 240px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.drive-crumb:hover { background: var(--hover); color: var(--text); }
.drive-crumb.root { color: var(--text); font-weight: 600; }
.drive-crumb-sep { display: inline-flex; color: var(--text-muted); opacity: .55; }
.drive-crumb-sep svg { width: 14px; height: 14px; }
.drive-crumb-title { font-size: 14px; font-weight: 600; }
.drive-back { width: 30px; height: 30px; margin-right: 4px; flex: none; }
.drive-back svg { width: 18px; height: 18px; }

.drive-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.drive-tool-sep { width: 1px; height: 22px; margin: 0 2px; background: var(--border); }
.drive-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background .13s ease, border-color .13s ease, color .13s ease;
}
.drive-btn:hover { background: var(--hover); border-color: var(--text-muted); }
.drive-btn svg { width: 15px; height: 15px; flex: none; }
.drive-btn.primary { background: var(--drive-primary); border-color: var(--drive-primary); color: #fff; }
.drive-btn.primary:hover { background: var(--drive-primary-hover); border-color: var(--drive-primary-hover); }
.drive-btn.danger { color: #f15c6d; border-color: rgba(241, 92, 109, .35); background: rgba(241, 92, 109, .08); }
.drive-btn.danger:hover { background: rgba(241, 92, 109, .16); border-color: #f15c6d; }
.drive-btn.ghost { background: transparent; }
.drive-sort {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.drive-order { width: 34px; height: 34px; }
.drive-order svg { width: 17px; height: 17px; }
.drive-viewtoggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.drive-viewtoggle button {
  width: 34px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.drive-viewtoggle button + button { border-left: 1px solid var(--border); }
.drive-viewtoggle button:hover { background: var(--hover); color: var(--text); }
.drive-viewtoggle button.active { background: var(--active); color: var(--text); }
.drive-viewtoggle svg { width: 16px; height: 16px; }

.drive-bulk {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--active);
}
.drive-bulk-count { margin-right: 6px; font-size: 12px; font-weight: 700; color: var(--text); }

.drive-drop { flex: 1; min-height: 0; position: relative; }
.drive-app.drive-dragging .drive-drop::after {
  content: "Drop files to upload";
  position: absolute;
  inset: 12px;
  z-index: 6;
  display: grid;
  place-items: center;
  border: 2px dashed var(--text-muted);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  pointer-events: none;
}
.drive-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 6px 10px 24px;
}
.drive-scroll-connect { display: grid; place-items: center; padding: 24px; }

/* ---------- file list ---------- */
.drive-table { min-width: 560px; }
.drive-thead,
.drive-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 150px 118px 84px 36px;
  align-items: center;
  gap: 8px;
}
.drive-thead {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.drive-row {
  padding: 7px 8px;
  border-radius: 9px;
  cursor: default;
  transition: background .1s ease;
}
.drive-row:hover { background: var(--hover); }
.drive-row.selected { background: var(--active); }
.drive-row.previewing { background: var(--active); }
.drive-check { display: grid; place-items: center; cursor: pointer; }
.drive-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--text-muted);
  cursor: pointer;
}
.drive-check span { display: none; }
.drive-name {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.drive-name-text { min-width: 0; }
.drive-name-text b {
  display: block;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drive-name-text small { display: block; margin-top: 1px; font-size: 10px; color: var(--text-muted); }
.drive-owner,
.drive-mod,
.drive-size {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drive-size { text-align: right; padding-right: 4px; }
.drive-row-menu {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
}
.drive-row:hover .drive-row-menu,
.drive-row.previewing .drive-row-menu,
.drive-row.selected .drive-row-menu { opacity: 1; }
.drive-row-menu:hover { background: var(--active); color: var(--text); }
.drive-row-menu svg { width: 18px; height: 18px; }

/* file-type badges */
.drive-ico {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  flex: none;
  background: rgba(138, 148, 166, .14);
  color: #8a94a6;
}
.drive-ico svg { width: 19px; height: 19px; }
.drive-ico.big { width: 84px; height: 84px; border-radius: 16px; }
.drive-ico.big svg { width: 42px; height: 42px; }
/* One neutral icon family, matching the calm line icons used in chat. */
.drive-ico-folder,
.drive-ico-doc,
.drive-ico-sheet,
.drive-ico-slide,
.drive-ico-pdf,
.drive-ico-image,
.drive-ico-video,
.drive-ico-audio,
.drive-ico-zip,
.drive-ico-file {
  background: rgba(134, 150, 160, .14);
  color: var(--text-muted);
}
/* File badges use the same extension-label shape as chat attachments, but
   stay monochrome instead of introducing a different colour per file type. */
.drive-ico-ext {
  background: rgba(134, 150, 160, .14);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.drive-ico-ext.big { font-size: 13px; }
.drive-card-thumb .drive-ico-ext.big { font-size: 12px; }
.drive-thumb-wrap { position: relative; width: 34px; height: 34px; flex: none; }
.drive-thumb-wrap .drive-ico { position: absolute; inset: 0; }
.drive-thumb {
  position: absolute;
  inset: 0;
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--panel-2);
}

/* ---------- grid ---------- */
.drive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 10px;
  padding: 8px 6px 20px;
}
.drive-card {
  position: relative;
  padding: 10px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  cursor: default;
  transition: border-color .13s ease, background .13s ease;
}
.drive-card:hover { background: var(--hover); border-color: var(--text-muted); }
.drive-card.selected { border-color: var(--text-muted); background: var(--active); }
.drive-card.previewing { border-color: var(--text-muted); }
.drive-card-thumb {
  height: 96px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 9px;
  background: var(--panel-2);
  overflow: hidden;
}
.drive-card-thumb .drive-ico.big { width: 54px; height: 54px; border-radius: 13px; background: transparent; }
.drive-card-thumb .drive-ico.big svg { width: 36px; height: 36px; }
.drive-card-thumb .drive-ico-ext.big { background: rgba(134, 150, 160, .14); }
.drive-card-thumb .drive-thumb-wrap,
.drive-card-thumb .drive-thumb { width: 100%; height: 100%; }
.drive-card-thumb .drive-thumb { border-radius: 0; object-fit: cover; }
.drive-card-thumb .drive-thumb-wrap .drive-ico { position: absolute; inset: 0; width: auto; height: auto; border-radius: 0; font-size: 12px; }
.drive-card-thumb .drive-thumb-wrap .drive-ico-ext { background: rgba(134, 150, 160, .14); }
.drive-card-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.drive-card-meta { margin-top: 3px; font-size: 10px; color: var(--text-muted); }
.drive-card-more {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--chip);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
}
.drive-card:hover .drive-card-more { opacity: 1; }
.drive-card-more:hover { color: var(--text); background: var(--active); }
.drive-card-more svg { width: 16px; height: 16px; }
.drive-card-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  opacity: 0;
}
.drive-card:hover .drive-card-check,
.drive-card.selected .drive-card-check { opacity: 1; }
.drive-card-check input { width: 16px; height: 16px; accent-color: var(--text-muted); }

/* ---------- shared drives ---------- */
.drive-shared-list { display: flex; flex-direction: column; gap: 4px; padding: 6px 6px; max-width: 720px; }
.drive-shared-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.drive-shared-item:hover { background: var(--hover); border-color: var(--border); }
.drive-shared-item > span:nth-child(2) { flex: 1; min-width: 0; }
.drive-shared-item b { display: block; font-size: 13px; font-weight: 600; }
.drive-shared-item small { display: block; margin-top: 1px; font-size: 10.5px; color: var(--text-muted); }
.drive-shared-item > svg { width: 16px; height: 16px; color: var(--text-muted); }

/* ---------- states ---------- */
.drive-empty {
  height: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.drive-empty .drive-ico.big { width: 64px; height: 64px; background: var(--panel-2); color: var(--text-muted); }
.drive-empty .drive-ico.big svg { width: 30px; height: 30px; }
.drive-empty b { font-size: 15px; color: var(--text); }
.drive-empty span { max-width: 360px; font-size: 12px; line-height: 1.5; }
.drive-empty .drive-btn { margin-top: 8px; }
.drive-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
  color: var(--text-muted);
  font-size: 12.5px;
}
.drive-loading.small { min-height: 100px; }
.drive-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: driveSpin 1.6s linear infinite;
}
@keyframes driveSpin { to { transform: rotate(360deg); } }
.drive-more {
  display: block;
  margin: 12px auto 4px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.drive-more:hover { border-color: var(--text-muted); color: var(--text-muted); }

/* ---------- preview ---------- */
.drive-preview {
  flex: none;
  width: 356px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--panel);
  min-height: 0;
}
.drive-preview-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
}
.drive-preview-head b {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drive-preview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--panel-2);
  overflow: hidden;
}
.drive-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 300px;
  border: 0;
  border-radius: 8px;
  background: #fff;
}
.drive-preview-media { width: 100%; max-height: 100%; display: flex; align-items: center; justify-content: center; }
.drive-preview-media img,
.drive-preview-media video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.drive-preview-media.audio audio { width: 100%; }
.drive-preview-none {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11.5px;
}
.drive-preview-none b { max-width: 100%; font-size: 13px; color: var(--text); word-break: break-word; }
.drive-preview-actions {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.drive-preview-actions .drive-btn { flex: 1; justify-content: center; padding: 7px 9px; font-size: 11px; }
.drive-preview-meta { flex: none; padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.drive-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.drive-meta-row:last-child { border-bottom: 0; }
.drive-meta-row span { color: var(--text-muted); flex: none; }
.drive-meta-row b { font-weight: 500; text-align: right; word-break: break-word; }

/* ---------- connect screen ---------- */
.drive-connect { width: 100%; display: grid; place-items: center; }
.drive-connect-card {
  width: min(520px, 100%);
  padding: 32px 30px 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}
.drive-connect-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--panel-2);
  color: var(--text-muted);
}
.drive-connect-logo svg { width: 36px; height: 36px; }
.drive-connect-card h2 { margin: 0 0 8px; font-size: 21px; font-weight: 600; letter-spacing: -.3px; }
.drive-connect-card > p { margin: 0 auto 16px; max-width: 400px; font-size: 13px; line-height: 1.55; color: var(--text-muted); }
.drive-connect-list { list-style: none; margin: 0 0 20px; padding: 0; text-align: left; }
.drive-connect-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 7px 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
.drive-connect-list svg { width: 16px; height: 16px; margin-top: 1px; color: var(--text-muted); flex: none; }
.drive-connect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--drive-primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.drive-connect-btn:hover { background: var(--drive-primary-hover); }
.drive-connect-btn svg { width: 18px; height: 18px; }
.drive-connect-secondary,
.drive-connect-link {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.drive-connect-secondary:hover,
.drive-connect-link:hover { color: var(--text); text-decoration: underline; }
.drive-connect-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(241, 92, 109, .1);
  color: #f15c6d;
  font-size: 12px;
  line-height: 1.45;
}
.drive-connect-loading { color: var(--text-muted); font-size: 12.5px; }
.drive-connect-note { margin-top: 16px !important; font-size: 10.5px !important; opacity: .72; line-height: 1.5 !important; }
.drive-connect-account { margin-top: 10px !important; font-size: 10.5px !important; color: var(--text-muted); }

/* Keep toasts visible over drive modals (the app default sits below them). */
.toast { z-index: 520; }

/* ---------- modals ---------- */
.drive-menu-sep { height: 1px; margin: 5px 6px; background: var(--border); }
.context-item.danger { color: #f15c6d; }
.context-item.danger:hover { background: rgba(241, 92, 109, .12); }
.context-item svg { width: 16px; height: 16px; flex: none; }

.drive-modal { width: min(540px, 100%); }
.drive-modal .drive-modal-body { padding: 0 24px 18px; }
.drive-modal-text { margin: 0 0 6px; font-size: 13px; font-weight: 500; word-break: break-word; }
.drive-modal-note { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }
.drive-modal .field input { margin-top: 7px; }
.drive-modal footer .danger { background: #d9534f; color: #fff; }
.drive-modal footer .danger:hover { background: #c9302c; }
.drive-modal footer .danger-text { color: #f15c6d; }
.drive-modal footer .danger-text:hover { background: rgba(241, 92, 109, .12); color: #f15c6d; }
.drive-modal footer .drive-footer-link {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.drive-modal footer .drive-footer-link:hover { background: var(--panel-2); }
.drive-account-footer { align-items: center; }
.drive-info-head { display: grid; place-items: center; padding: 6px 0 18px; }
.drive-info-list { border-top: 1px solid var(--border); }

/* move picker */
.drive-move-modal { width: min(560px, 100%); }
.drive-move-crumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 20px 10px;
  overflow-x: auto;
}
.drive-move-crumbs button {
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
}
.drive-move-crumbs button:hover { background: var(--hover); color: var(--text); }
.drive-move-crumbs span { display: inline-flex; color: var(--text-muted); opacity: .6; }
.drive-move-crumbs svg { width: 13px; height: 13px; }
.drive-move-list { max-height: 300px; overflow-y: auto; padding: 0 14px 8px; }
.drive-move-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.drive-move-row:hover { background: var(--hover); }
.drive-move-row > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-move-row > svg { width: 14px; height: 14px; color: var(--text-muted); }
.drive-move-empty { padding: 22px 12px; text-align: center; font-size: 12px; color: var(--text-muted); }

/* sharing */
.drive-share-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}
.drive-share-link-copy { flex: 1; min-width: 0; }
.drive-share-link-copy b { display: block; font-size: 12.5px; }
.drive-share-link-copy small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--text-muted); }
.drive-share-anyone {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.drive-share-anyone:hover { border-color: var(--text-muted); }
.drive-share-anyone input { width: 16px; height: 16px; accent-color: var(--text-muted); }
.drive-share-anyone b { display: block; font-size: 12.5px; }
.drive-share-anyone small { display: block; margin-top: 1px; font-size: 10.5px; color: var(--text-muted); }
.drive-share-label { margin: 16px 0 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.drive-share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-radius: 8px;
}
.drive-share-row:hover { background: var(--hover); }
.drive-share-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  background: var(--panel-2);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
}
.drive-share-avatar img { width: 100%; height: 100%; object-fit: cover; }
.drive-share-who { flex: 1; min-width: 0; }
.drive-share-who b,
.drive-share-who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-share-who b { font-size: 12.5px; font-weight: 500; }
.drive-share-who small { margin-top: 1px; font-size: 10.5px; color: var(--text-muted); }
.drive-share-role {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  outline: none;
}
.drive-share-owner { font-size: 10.5px; color: var(--text-muted); }
.drive-share-remove { width: 28px; height: 28px; }
.drive-share-remove svg { width: 15px; height: 15px; }
.drive-share-empty { padding: 10px 4px; font-size: 11.5px; color: var(--text-muted); }
.drive-share-add {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.drive-share-add input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.drive-share-add input:focus { border-color: var(--text-muted); }
.drive-share-add select {
  height: 36px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 11.5px;
  outline: none;
}
.drive-share-add .drive-btn { flex: none; }

/* account modal */
.drive-account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}
.drive-account-card img,
.drive-account-card > span {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  flex: none;
}
.drive-account-card b { display: block; font-size: 13.5px; }
.drive-account-card small { display: block; margin-top: 2px; font-size: 11px; color: var(--text-muted); }
.drive-account-footer { justify-content: space-between; }

/* ---------- upload tray ---------- */
.drive-uploads {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(340px, calc(100% - 36px));
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.drive-uploads header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.drive-uploads header b { font-size: 12px; font-weight: 600; }
.drive-uploads header span { margin-left: auto; font-size: 10.5px; color: var(--text-muted); }
.drive-uploads header .icon-btn { width: 26px; height: 26px; }
.drive-uploads header .icon-btn svg { width: 14px; height: 14px; }
.drive-upload-list { max-height: 240px; overflow-y: auto; padding: 6px 10px 10px; }
.drive-upload { padding: 7px 0; }
.drive-upload-main { display: flex; align-items: center; gap: 10px; }
.drive-upload-name {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drive-upload-status { flex: none; font-size: 10px; color: var(--text-muted); }
.drive-upload.error .drive-upload-status { color: #f15c6d; }
.drive-upload.done .drive-upload-status { color: var(--text-muted); }
.drive-upload-bar {
  height: 3px;
  margin-top: 6px;
  border-radius: 3px;
  background: var(--panel-2);
  overflow: hidden;
}
.drive-upload-bar span { display: block; height: 100%; border-radius: 3px; background: var(--text-muted); transition: width .15s linear; }
.drive-upload.error .drive-upload-bar span { background: #f15c6d; }
.drive-upload-cancel {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.drive-upload-cancel:hover { text-decoration: underline; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .drive-preview { width: 310px; }
  .drive-thead, .drive-row { grid-template-columns: 34px minmax(0, 1fr) 120px 100px 72px 36px; }
}
@media (max-width: 1000px) {
  .drive-nav { width: 196px; }
  .drive-owner { display: none; }
  .drive-thead > span:nth-child(3) { display: none; }
  .drive-thead, .drive-row { grid-template-columns: 34px minmax(0, 1fr) 110px 70px 36px; }
  .drive-preview {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 92%);
    z-index: 8;
    box-shadow: -12px 0 30px rgba(0, 0, 0, .18);
  }
}
@media (max-width: 820px) {
  .drive-app { left: 0; }
  .drive-head { padding: 0 10px 0 12px; gap: 8px; }
  .drive-brand { min-width: 0; }
  .drive-brand-copy { display: none; }
  .drive-quota { display: none; }
  .drive-search { height: 38px; }
  .drive-nav {
    width: 58px;
    padding: 8px 5px;
    align-items: center;
  }
  .drive-nav-item { justify-content: center; padding: 11px 0; }
  .drive-nav-item > span:not(.drive-nav-ico) { display: none; }
  .drive-nav-sep { width: calc(100% - 16px); margin: 6px auto; }
  .drive-nav-label,
  .drive-nav-account-copy,
  .drive-nav-account > svg { display: none; }
  .drive-nav-account { justify-content: center; padding: 9px 0; }
  .drive-nav-account-dot { width: 10px; height: 10px; }
  .drive-toolbar { padding: 8px 10px; gap: 8px; }
  .drive-tools { gap: 4px; }
  .drive-tools .drive-btn span { display: none; }
  .drive-tools .drive-btn { padding: 8px; }
  .drive-thead, .drive-row { grid-template-columns: 30px minmax(0, 1fr) 84px 30px; }
  .drive-mod, .drive-thead > span:nth-child(4) { display: none; }
  .drive-scroll { padding: 4px 6px 20px; }
  .drive-preview { width: 100%; }
  .drive-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
  .drive-card-thumb { height: 82px; }
}
@media (max-width: 620px) {
  .drive-brand-mark { width: 32px; height: 32px; }
  .drive-viewtoggle, .drive-tool-sep, .drive-quota { display: none; }
  .drive-sort { max-width: 96px; }
  .drive-thead, .drive-row { grid-template-columns: 26px minmax(0, 1fr) 30px; }
  .drive-size, .drive-thead > span:nth-child(5) { display: none; }
  .drive-row { padding: 8px 4px; }
  .drive-uploads { right: 10px; bottom: 10px; }
  .drive-connect-card { padding: 24px 18px 18px; }
  .drive-share-add { flex-wrap: wrap; }
  .drive-share-add input { flex-basis: 100%; }
}

/* Touch devices have no hover: keep row actions visible. */
@media (hover: none) {
  .drive-row-menu,
  .drive-card-more,
  .drive-card-check { opacity: 1; }
}

/* Drive dialogs use neutral primary actions instead of the app's green. */
.drive-modal footer .primary {
  background: var(--drive-primary);
  border-color: var(--drive-primary);
  color: #fff;
}
.drive-modal footer .primary:hover {
  background: var(--drive-primary-hover);
  border-color: var(--drive-primary-hover);
  color: #fff;
}
.drive-modal .field input:focus,
.drive-modal .field select:focus { border-color: var(--text-muted); }

/* Neutral focus rings and dialog labels inside Drive. */
.drive-app button:focus-visible,
.drive-app input:focus-visible,
.drive-app select:focus-visible,
.drive-app textarea:focus-visible,
.drive-modal button:focus-visible,
.drive-modal input:focus-visible,
.drive-modal select:focus-visible,
.drive-modal textarea:focus-visible { outline-color: var(--text-muted); }
.drive-modal header span { color: var(--text-muted); }

#driveMenu button:focus-visible { outline-color: var(--text-muted); }

/* -------------------------------------------------------------
   Files theme: "WhatsApp"
   The file manager follows the app's WhatsApp palette instead of
   the old neutral graphite look.
   ------------------------------------------------------------- */
.drive-app[data-drive-theme="whatsapp"],
.drive-modal[data-drive-theme="whatsapp"] {
  --drive-primary: var(--accent);
  --drive-primary-hover: color-mix(in srgb, var(--accent) 82%, #000);
  --drive-icon-bg: var(--accent-soft);
  --drive-icon-color: var(--accent);
  --drive-selected: var(--accent-soft);
}
.drive-app[data-drive-theme="whatsapp"] .drive-brand-mark {
  background: var(--accent-soft);
  color: var(--accent);
}
.drive-app[data-drive-theme="whatsapp"] button:focus-visible,
.drive-app[data-drive-theme="whatsapp"] input:focus-visible,
.drive-app[data-drive-theme="whatsapp"] select:focus-visible,
.drive-app[data-drive-theme="whatsapp"] textarea:focus-visible,
.drive-modal[data-drive-theme="whatsapp"] button:focus-visible,
.drive-modal[data-drive-theme="whatsapp"] input:focus-visible,
.drive-modal[data-drive-theme="whatsapp"] select:focus-visible,
.drive-modal[data-drive-theme="whatsapp"] textarea:focus-visible {
  outline-color: var(--accent);
}

/* Sidebar folder bookmarks */
.drive-nav-bookmark {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.drive-nav-bookmark .drive-nav-item { flex: 1; min-width: 0; }
.drive-bookmark-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drive-bookmark-remove {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
}
.drive-bookmark-remove svg { width: 13px; height: 13px; }
.drive-nav-bookmark:hover .drive-bookmark-remove { opacity: 1; }
.drive-bookmark-remove:hover { background: var(--active); color: var(--text); }
.drive-nav-bookmark.active .drive-nav-item { background: var(--active); color: var(--text); }
.drive-btn.active {
  background: var(--active);
  border-color: var(--text-muted);
  color: var(--text);
}
@media (hover: none) {
  .drive-bookmark-remove { opacity: 1; }
}
@media (max-width: 820px) {
  .drive-bookmark-remove { display: none; }
}

/* Draggable preview divider */
.drive-resize {
  flex: none;
  width: 7px;
  position: relative;
  z-index: 4;
  cursor: col-resize;
  background: transparent;
  outline: none;
}
.drive-resize::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background .15s ease;
}
.drive-resize:hover::after,
.drive-resize:focus-visible::after,
.drive-app.resizing .drive-resize::after { background: var(--text-muted); }
.drive-app.resizing { cursor: col-resize; user-select: none; }
.drive-app.resizing .drive-preview { transition: none; }
@media (max-width: 1000px) {
  .drive-resize { display: none; }
}
/* ============================================================
   Auth — split marketing panel + focused security form
   ============================================================ */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  overflow-y: auto;
  background: var(--app-bg);
  color: var(--text);
}
.auth-screen[hidden] { display: none !important; }

.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(440px, .94fr);
}

/* ---------- left story panel ---------- */
.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 38px 52px 30px;
  color: #e9edef;
  background:
    radial-gradient(ellipse 80% 55% at 12% 0%, rgba(0, 168, 132, .34), transparent 62%),
    radial-gradient(ellipse 70% 50% at 105% 112%, rgba(0, 168, 132, .22), transparent 60%),
    linear-gradient(150deg, #071f1c 0%, #0b141a 48%, #08241f 100%);
}
.auth-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 72% 72% at 35% 40%, #000 20%, transparent 78%);
  pointer-events: none;
}
.auth-aside::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -160px;
  bottom: -160px;
  border-radius: 50%;
  border: 1px solid rgba(0, 168, 132, .22);
  box-shadow: 0 0 0 60px rgba(0, 168, 132, .04), 0 0 0 120px rgba(0, 168, 132, .025);
  pointer-events: none;
}
.auth-aside-top,
.auth-aside-copy,
.auth-aside-foot { position: relative; z-index: 1; }

.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #00c79a, #007a63);
  color: #fff;
  font-size: 21px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 168, 132, .3);
}
.auth-logo b { display: block; font-size: 17px; letter-spacing: -.2px; }
.auth-logo span { display: block; margin-top: 2px; font-size: 11px; color: rgba(233, 237, 239, .6); }

.auth-aside-copy { margin: auto 0; padding: 56px 0 40px; max-width: 540px; }
.auth-eyebrow {
  margin: 0 0 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  color: #4fd9b8;
}
.auth-aside-copy h1 {
  margin: 0 0 18px;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.16;
  font-weight: 650;
  letter-spacing: -.9px;
}
.auth-aside-lead {
  margin: 0 0 30px;
  max-width: 440px;
  font-size: 14px;
  line-height: 1.65;
  color: rgba(233, 237, 239, .66);
}
.auth-feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.auth-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  backdrop-filter: blur(4px);
}
.auth-feature-ico {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(0, 168, 132, .16);
  color: #4fd9b8;
}
.auth-feature-ico svg { width: 18px; height: 18px; }
.auth-feature-list b { display: block; font-size: 12.5px; font-weight: 600; }
.auth-feature-list small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.45; color: rgba(233, 237, 239, .55); }
.auth-aside-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
  font-size: 10.5px;
  color: rgba(233, 237, 239, .5);
}
.auth-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00d95f;
  box-shadow: 0 0 0 4px rgba(0, 217, 95, .12);
  flex: none;
}

/* ---------- right form panel ---------- */
.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 36px 28px;
  background:
    radial-gradient(ellipse 70% 45% at 90% -10%, var(--accent-soft), transparent 70%),
    var(--app-bg);
}
.auth-mobile-brand { display: none; }
.auth-card {
  width: min(420px, 100%);
  padding: 30px 30px 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .16);
}
:root[data-theme="dark"] .auth-card { box-shadow: 0 22px 70px rgba(0, 0, 0, .5); }

.auth-view { animation: authViewIn .22s ease; }
@keyframes authViewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.auth-head { margin-bottom: 24px; }
.auth-kicker {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--accent);
}
.auth-head h2 { margin: 0 0 7px; font-size: 25px; font-weight: 650; letter-spacing: -.5px; }
.auth-head p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text-muted); }
.auth-head p b { font-weight: 600; color: var(--text); }

.auth-form { display: block; }
.auth-field {
  display: block;
  margin-bottom: 15px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.auth-field > span { display: block; margin-bottom: 6px; }
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-wrap > svg {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
}
.auth-input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 41px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.auth-input-wrap input::placeholder { color: var(--text-muted); opacity: .7; }
.auth-input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-pw-toggle {
  position: absolute;
  right: 6px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.auth-pw-toggle:hover { background: var(--hover); color: var(--text); }
.auth-pw-toggle svg { width: 18px; height: 18px; }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 16px;
}
.auth-row-note { font-size: 11px; color: var(--text-muted); }
.auth-link {
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.auth-link:hover { text-decoration: underline; }
.auth-link:disabled { color: var(--text-muted); cursor: default; text-decoration: none; }

.auth-error,
.auth-success {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.45;
}
.auth-error {
  background: rgba(241, 92, 109, .11);
  border: 1px solid rgba(241, 92, 109, .35);
  color: #f18b96;
}
.auth-success {
  background: var(--accent-soft);
  border: 1px solid rgba(0, 168, 132, .35);
  color: var(--accent);
}
.auth-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 48px;
  margin-top: 2px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #00b389, #008e73);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 168, 132, .24);
  transition: transform .12s ease, filter .15s ease, opacity .15s ease;
}
.auth-submit:hover { filter: brightness(1.06); transform: translateY(-1px); }
.auth-submit:active { transform: none; }
.auth-submit:disabled { opacity: .7; cursor: default; transform: none; }
.auth-submit.small { width: auto; height: 38px; padding: 0 16px; font-size: 12.5px; margin: 0; }
.auth-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin .7s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }
.auth-secondary {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.auth-secondary:hover { border-color: var(--text-muted); background: var(--hover); }

.auth-switch {
  margin: 20px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.auth-switch button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.auth-switch button:hover { text-decoration: underline; }

.auth-fine-print {
  margin: 11px 0 0;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-muted);
}
.auth-legal {
  width: min(420px, 100%);
  margin: 0;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-muted);
  opacity: .8;
}

/* ---------- password strength ---------- */
.auth-strength { margin: -4px 0 16px; }
.auth-strength-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 6px; }
.auth-strength-track span {
  height: 4px;
  border-radius: 3px;
  background: var(--panel-2);
  transition: background .18s ease;
}
.auth-strength[data-score="1"] .auth-strength-track span.on { background: #e2574c; }
.auth-strength[data-score="2"] .auth-strength-track span.on { background: #f0a22e; }
.auth-strength[data-score="3"] .auth-strength-track span.on { background: #79b93f; }
.auth-strength[data-score="4"] .auth-strength-track span.on { background: var(--accent); }
.auth-strength-label { font-size: 10.5px; line-height: 1.45; color: var(--text-muted); }

/* ---------- 2FA ---------- */
.auth-code-wrap input {
  padding-left: 41px;
  text-align: center;
  letter-spacing: .45em;
  font-size: 20px;
  font-weight: 600;
}
.auth-code-wrap input::placeholder { letter-spacing: .3em; }
.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 16px;
  cursor: pointer;
}
.auth-check input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  flex: none;
}
.auth-check b { display: block; font-size: 12px; font-weight: 600; color: var(--text); }
.auth-check small { display: block; margin-top: 1px; font-size: 10.5px; color: var(--text-muted); }
.auth-twofa-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.auth-dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); opacity: .5; }
.auth-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 16px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.auth-back:hover { color: var(--text); }
.auth-back svg { width: 14px; height: 14px; }

/* ---------- recovery codes ---------- */
.auth-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 16px;
}
.auth-codes code {
  padding: 10px 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: center;
}
.auth-codes-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-codes-actions .auth-secondary { flex: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .auth-aside { padding: 32px 36px 26px; }
  .auth-aside-copy h1 { font-size: 32px; }
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: 28px 18px 36px; }
  .auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    width: min(420px, 100%);
    margin-bottom: 2px;
  }
  .auth-mobile-brand .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #00c79a, #007a63);
    color: #fff;
    font-weight: 800;
    font-size: 19px;
  }
  .auth-mobile-brand b { display: block; font-size: 15px; }
  .auth-mobile-brand span { display: block; margin-top: 1px; font-size: 10.5px; color: var(--text-muted); }
  .auth-card { padding: 26px 22px 24px; }
}
@media (max-width: 480px) {
  .auth-main { padding: 20px 12px 28px; }
  .auth-card { border-radius: 16px; }
  .auth-head h2 { font-size: 22px; }
  .auth-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .auth-codes { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-view { animation: none; }
}

/* ============================================================
   Minimal single-card presentation
   No marketing panel, no security pitch — just the form.
   ============================================================ */
.auth-shell {
  grid-template-columns: 1fr;
  min-height: 100dvh;
}
.auth-aside { display: none; }
.auth-main {
  min-height: 100dvh;
  justify-content: center;
  gap: 0;
  padding: 28px 18px;
  background: var(--app-bg);
}
.auth-card {
  width: min(400px, 100%);
  padding: 28px 26px 26px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
:root[data-theme="dark"] .auth-card { box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.auth-card-brand .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}
.auth-card-brand b { display: block; font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
.auth-card-brand span { display: block; margin-top: 1px; font-size: 10.5px; color: var(--text-muted); }
.auth-kicker { display: none; }
.auth-head { margin-bottom: 20px; }
.auth-head h2 { font-size: 23px; margin-bottom: 6px; }
.auth-row { justify-content: flex-end; }
.auth-row-note,
.auth-fine-print,
.auth-legal { display: none; }
.auth-submit {
  background: var(--accent);
  box-shadow: none;
}
.auth-submit:hover { background: #06b78f; filter: none; transform: none; }

/* Boot splash: shown until the session check finishes, so the chat shell
   can never flash before the login screen or the empty state. */
.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f7f5f3;
}
/* The inline theme script sets data-theme before first paint, so the splash
   can follow it; otherwise dark mode shows white text on the light fallback. */
:root[data-theme="dark"] .boot-splash { background: var(--app-bg); }
:root[data-theme="dark"] .boot-progress-bar { background: var(--accent); }
.boot-card {
  width: min(340px, 100%);
  text-align: center;
}
.boot-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-bottom: 14px;
}
.boot-splash .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: none;
}
.boot-wordmark {
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -.7px;
  color: var(--text);
}
.boot-tagline {
  margin: 0 auto 26px;
  max-width: 280px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.boot-progress {
  width: 50%;
  height: 5px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.boot-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: rgba(0, 0, 0, .55);
  transition: width .18s ease;
}
.boot-progress-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 10.5px;
  letter-spacing: .01em;
}
@media (prefers-reduced-motion: reduce) {
  .boot-progress-bar { transition: none; }
}

/* Demo instance: entry on the sign-in card and the in-app note. */
.auth-demo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 24px;
  padding: 16px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.auth-demo p { margin: 0; font-size: 14px; line-height: 20px; }
.auth-demo .auth-submit { margin-top: 0; }
.demo-banner {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 16px;
  border-radius: 9999px;
  background: #111b21;
  color: #fff;
  font-size: 13px;
  line-height: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.demo-banner a { color: #7ee2c5; font-weight: 600; white-space: nowrap; text-decoration: none; }
.demo-banner a:hover { text-decoration: underline; }
.demo-banner button {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
@media (max-width: 720px) {
  .demo-banner {
    left: 16px;
    right: 16px;
    bottom: 104px;
    transform: none;
    max-width: none;
    border-radius: 16px;
    font-size: 12px;
    line-height: 16px;
  }
  .demo-banner span { flex: 1; min-width: 0; }
}
/* ============================================================
   Account security modal
   ============================================================ */

.security-modal {
  width: min(680px, 100%);
  max-height: min(92dvh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.security-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 22px 22px 14px 24px;
}
/* `.security-head` raises specificity above the shared `.task-modal header
   span { display: block }` eyebrow rule, which otherwise un-centres the icon. */
.security-head .security-shield {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.security-shield svg { width: 22px; height: 22px; }
.security-head > div { flex: 1; min-width: 0; }
/* Eyebrow label only: a bare `.security-head span` also hit the shield tile
   (a span) and its display:block broke the tile's grid centring. */
.security-head > div > span {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent);
}
.security-head h2 { margin: 4px 0 0; font-size: 20px; font-weight: 650; letter-spacing: -.3px; }
.security-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.security-head .icon-btn { margin-top: -4px; }

.security-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 24px 18px;
}

/* status card */
.security-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
}
.security-status.is-on { border-color: rgba(0, 168, 132, .35); background: linear-gradient(135deg, var(--accent-soft), transparent 70%); }
.security-status.is-off { border-color: rgba(240, 162, 46, .38); background: linear-gradient(135deg, rgba(240, 162, 46, .1), transparent 70%); }
.security-status-copy { flex: 1; min-width: 0; }
.security-pill {
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .1em;
}
.is-on .security-pill { background: rgba(0, 168, 132, .16); color: var(--accent); }
.is-off .security-pill { background: rgba(240, 162, 46, .16); color: #d99416; }
.security-status-copy b { display: block; font-size: 14px; font-weight: 600; }
.security-status-copy small { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
.security-recovery-note { display: block; margin-top: 5px; font-size: 10.5px; color: var(--text-muted); }
.security-status-actions { flex: none; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.security-danger {
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(241, 92, 109, .35);
  border-radius: 9px;
  background: rgba(241, 92, 109, .08);
  color: #f15c6d;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.security-danger:hover { background: rgba(241, 92, 109, .16); border-color: #f15c6d; }
.security-required {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
}

/* flow panel */
.security-flow {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--accent);
  border-radius: 13px;
  background: var(--panel-2);
}
.security-flow h3 { margin: 0 0 5px; font-size: 14px; font-weight: 600; }
.security-flow > p { margin: 0 0 14px; font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }
.security-flow .auth-field { margin-bottom: 12px; }
.security-flow .auth-input-wrap input { height: 42px; }
.security-flow-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.security-flow-actions .auth-submit { height: 38px; width: auto; padding: 0 16px; font-size: 12.5px; margin: 0; }
.security-flow .form-error { margin-bottom: 10px; }
.security-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.security-codes code {
  padding: 9px 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  letter-spacing: .04em;
}

/* sections */
.security-section { margin-top: 22px; }
.security-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.security-section-head h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.security-section-head h3 em { margin-left: 4px; font-style: normal; font-weight: 600; color: var(--text-muted); }
.security-section-head button {
  padding: 3px 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.security-section-head button:hover { text-decoration: underline; }
.security-list { border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.security-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: var(--panel);
}
.security-row + .security-row { border-top: 1px solid var(--border); }
.security-row:hover { background: var(--hover); }
.security-row-ico {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text-muted);
}
.security-row-ico svg { width: 17px; height: 17px; }
.security-row-main { flex: 1; min-width: 0; }
.security-row-main b { display: block; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.security-row-main b em { margin-left: 5px; padding: 2px 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-style: normal; font-size: 8.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.security-row-main small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--text-muted); }
.security-row-action {
  flex: none;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.security-row-action:hover { background: var(--active); color: var(--text); }
.security-row-action.danger { color: #f15c6d; }
.security-empty { padding: 16px 14px; font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }

/* activity */
.security-events { border: 1px solid var(--border); border-radius: 11px; padding: 6px 13px; }
.security-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}
.security-event + .security-event { border-top: 1px solid var(--border); }
.security-event-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .65;
  flex: none;
}
.security-event-main { min-width: 0; }
.security-event-main b { display: block; font-size: 11.5px; font-weight: 500; }
.security-event-main small { display: block; margin-top: 1px; font-size: 10px; color: var(--text-muted); }
.security-error { padding: 20px; text-align: center; font-size: 12.5px; color: var(--text-muted); }

.security-modal > footer {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.security-modal > footer button {
  padding: 9px 15px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.security-modal > footer button:hover { background: var(--hover); color: var(--text); }

@media (max-width: 620px) {
  .security-status { flex-direction: column; align-items: stretch; }
  .security-status-actions { flex-direction: row; }
  .security-status-actions > * { flex: 1; }
  .security-codes { grid-template-columns: 1fr; }
  .security-body { padding: 0 16px 16px; }
  .security-head { padding: 18px 14px 12px 16px; }
  .security-modal > footer { padding: 12px 16px; }
}
/* ---------- RFI (chat-backed) ---------- */
#rfiFilters {
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* RFI conversation avatar */
.rfi-avatar.open { background: linear-gradient(135deg, #0a7c66, #00a884); }
.rfi-avatar.answered { background: linear-gradient(135deg, #f0b232, #c9871a); }
.rfi-avatar.closed { background: linear-gradient(135deg, #6f8290, #46545e); }

/* Submittal conversations reuse the workflow with a blue identity. */
.submittal-avatar.open { background: linear-gradient(135deg, #2563a8, #3b82c4); }
.submittal-avatar.answered { background: linear-gradient(135deg, #b07a1e, #d19a2c); }
.submittal-avatar.closed { background: linear-gradient(135deg, #5c6b84, #3f4b60); }

/* Change orders are an approval workflow with a warm accent. */
.change-order-avatar.open { background: linear-gradient(135deg, #a8551a, #d97706); }
.change-order-avatar.answered { background: linear-gradient(135deg, #b07a1e, #d19a2c); }
.change-order-avatar.closed { background: linear-gradient(135deg, #2f7a61, #15956f); }

/* shared small type */
.rfi-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.rfi-muted {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- right-hand detail panel ---------- */
.rfi-detail-scroll { padding: 12px 0 26px; }

.rfi-timeline { padding: 4px 18px 2px; }
.rfi-timeline-node {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  padding-bottom: 20px;
}
.rfi-timeline-node:last-child { padding-bottom: 4px; }
.rfi-timeline-node:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 38px;
  bottom: -2px;
  width: 2px;
  background: var(--scroll);
}
.rfi-timeline-node.current:not(:last-child)::before {
  background: linear-gradient(180deg, var(--accent), var(--border));
}
.rfi-timeline-node.skipped:not(:last-child)::before {
  left: 17px;
  width: 0;
  border-left: 2px dashed var(--border);
  background: none;
}
.rfi-timeline-marker {
  position: relative;
  z-index: 1;
  width: 34px;
  padding-top: 1px;
}
.rfi-timeline-marker .mini-avatar {
  width: 34px;
  height: 34px;
  font-size: 11px;
}
/* The ball-in-court assignee is always highlighted, on every theme, whether or
   not animations are enabled. The pulse in the WhatsApp theme is additive. */
.rfi-timeline-node.current .rfi-timeline-marker .mini-avatar {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 5px var(--accent);
}
.rfi-timeline-node.skipped .rfi-timeline-marker { opacity: .55; }
.rfi-ball-badge {
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}
.rfi-ball-badge svg { width: 11px; height: 11px; }
.rfi-timeline-body { min-width: 0; }
.rfi-timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
}
.rfi-timeline-head > div { min-width: 0; }
.rfi-timeline-head b {
  display: block;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}
.rfi-timeline-head > div:first-child > span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.rfi-timeline-meta {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.rfi-timeline-meta time {
  padding-top: 0;
  color: var(--text-muted);
  font-size: 9.5px;
  white-space: nowrap;
}
.rfi-node-due {
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}
.rfi-node-due.overdue {
  color: #ff8a80;
  font-weight: 600;
}
.rfi-timeline-node.current .rfi-timeline-head b { color: var(--accent); }
.rfi-timeline-node.done .rfi-timeline-head b { opacity: .82; }
.rfi-timeline-node.skipped { opacity: .55; }

.rfi-node-text {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.rfi-node-text.muted { color: var(--text-muted); font-style: italic; }
.rfi-node-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.rfi-final-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-style: normal;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* folded details keep the timeline calm */
.rfi-fold { margin-top: 7px; }
.rfi-fold summary {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  list-style: none;
  color: var(--text-muted);
  font-size: 10.5px;
  cursor: pointer;
}
.rfi-fold summary::-webkit-details-marker { display: none; }
.rfi-fold summary::before {
  content: "›";
  font-size: 14px;
  line-height: 1;
  transition: transform .15s ease;
}
.rfi-fold[open] summary::before { transform: rotate(90deg); }
.rfi-fold summary span { font-weight: 600; }
.rfi-fold summary em {
  margin-left: auto;
  font-style: normal;
  font-size: 9px;
  opacity: .7;
}
.rfi-fold-body { padding: 6px 0 2px; }
.rfi-answer-record + .rfi-answer-record {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.rfi-answer-record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.rfi-answer-record-head time {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* final answer below the timeline */
.rfi-final-answer {
  margin: 6px 18px 18px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 11px;
  background: var(--panel-2);
}
.rfi-final-label {
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.rfi-final-head {
  display: flex;
  align-items: center;
  gap: 9px;
}
.rfi-final-head .mini-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  font-size: 10px;
}
.rfi-final-head > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rfi-final-head b { font-size: 12.5px; font-weight: 600; }
.rfi-final-head small { color: var(--text-muted); font-size: 10px; }
.rfi-accepted-badge,
.rfi-waiting-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 999px;
  font-style: normal;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.rfi-accepted-badge {
  background: var(--accent-soft);
  color: var(--accent);
}
.rfi-accepted-badge svg { width: 10px; height: 10px; }
.rfi-waiting-badge {
  background: rgba(217, 164, 65, .15);
  color: #d9a441;
}
.rfi-accepted-meta {
  margin: 11px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

/* editors, meta */
.rfi-editors { margin: 4px 18px 16px; }
.rfi-editor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rfi-editor-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11px;
}
.rfi-editor-chip .mini-avatar {
  flex: none;
  width: 20px;
  height: 20px;
  font-size: 8px;
}
.rfi-editor-chip button {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.rfi-editor-chip button:hover { color: var(--accent); }
.rfi-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 18px 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.rfi-detail-meta > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rfi-detail-meta > div > span {
  color: var(--text-muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.rfi-detail-meta > div { font-size: 11.5px; line-height: 1.4; }
.rfi-impact-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.rfi-impact-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
}
.rfi-impact-pill svg { width: 10px; height: 10px; opacity: .25; }
.rfi-impact-pill.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.rfi-impact-pill.on svg { opacity: 1; }

/* handoff / editor movement */
.rfi-handoff,
.rfi-jump {
  margin: 6px 18px 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
}
.rfi-handoff-hint {
  margin: -2px 0 9px;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.45;
}
.rfi-handoff textarea {
  display: block;
  width: 100%;
  min-height: 68px;
  resize: vertical;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.5;
  outline: none;
}
.rfi-handoff textarea:focus { border-color: var(--accent); }
.rfi-handoff-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
}

/* In-flight attachment uploads: name, percentage and a moving bar. */
.rfi-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
}
.rfi-upload-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11.5px;
  color: var(--text);
}
.rfi-upload-name svg { width: 14px; height: 14px; flex: none; color: var(--text-muted); }
.rfi-upload-name span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rfi-upload-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.rfi-upload .doc-progress { grid-column: 1 / -1; margin-top: 2px; }
.rfi-attach-list .rfi-upload { flex: 1 1 100%; }
.rfi-btn {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.rfi-btn:hover { background: var(--hover); color: var(--text); }
.rfi-btn.primary {
  margin-left: auto;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.rfi-btn.primary:hover { background: #06b78f; color: #fff; }
.rfi-btn:disabled { opacity: .45; cursor: not-allowed; }
.rfi-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 2px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.rfi-text-btn:hover { color: var(--accent); }
.rfi-text-btn svg { width: 13px; height: 13px; }
.rfi-jump-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.rfi-jump-row select {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 11.5px;
  outline: none;
}
.rfi-jump-row select:focus { border-color: var(--accent); }
.rfi-jump-row .rfi-btn.primary { margin-left: 0; }
.rfi-decision {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 18px 18px;
}
.rfi-decision .rfi-btn.primary { margin-left: 0; }

/* ---------- in-app confirmation ---------- */
.rfi-confirm-modal { width: min(460px, 100%); }
.rfi-confirm-body {
  padding: 0 26px 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.rfi-confirm-body p { margin: 0 0 10px; }
.rfi-confirm-body p:last-child { margin-bottom: 0; }

/* ---------- create modal ---------- */
.rfi-modal { width: min(640px, 100%); }
.rfi-create-modal { max-height: min(92dvh, 920px); }
.rfi-source-quote {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 24px 14px;
  padding: 9px 11px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}
.rfi-source-icon { flex: none; display: inline-flex; color: var(--accent); }
.rfi-source-icon svg { width: 15px; height: 15px; }
.rfi-source-quote div { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rfi-source-quote b { color: var(--accent); font-size: 11.5px; font-weight: 600; }
.rfi-source-quote span {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.rfi-form { padding: 0 24px 4px; }
.rfi-form .field {
  padding-left: 0;
  padding-right: 0;
}
.rfi-form-section {
  padding: 15px 0;
  border-top: 1px solid var(--border);
}
.rfi-form-first { padding-top: 0; border-top: 0; }
.rfi-form-section .field:last-child { padding-bottom: 0; }
.rfi-impact-field { padding-top: 2px; }
.rfi-impact-field .field-label {
  display: block;
  margin-bottom: 8px;
}
.rfi-create-modal .rfi-impact-pill {
  padding: 6px 11px;
  font-size: 11.5px;
}
.rfi-create-modal .rfi-impact-pill svg { width: 12px; height: 12px; }
.rfi-impact-pills button { cursor: pointer; }
.rfi-impact-pills button:hover { border-color: var(--accent); }
.rfi-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.rfi-section-head .field-label { margin-bottom: 0; }
.rfi-section-hint {
  flex: none;
  color: var(--text-muted);
  font-size: 10px;
  text-align: right;
}
.rfi-field-hint {
  margin: -2px 0 9px;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.rfi-assignee-flow { margin-top: 2px; }
.rfi-assignee-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 12px;
}
.rfi-assignee-row:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 30px;
  bottom: -2px;
  width: 2px;
  background: var(--scroll);
}
.rfi-flow-node {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  margin-top: 7px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
}
.rfi-flow-node.filled {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.rfi-assignee-body {
  grid-column: 2;
  min-width: 0;
}
.rfi-assignee-input {
  width: 100%;
  height: 38px;
  padding: 8px 34px 8px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.rfi-assignee-input:focus { border-color: var(--accent); }
.rfi-selected-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rfi-selected-person {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  padding: 4px 32px 4px 4px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent-soft);
}
.rfi-selected-person .mini-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  font-size: 10px;
}
.rfi-selected-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}
.rfi-selected-dept {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.rfi-selected-person .rfi-final-badge { margin-top: 0; flex: none; }
.rfi-assignee-due {
  display: flex;
  align-items: center;
  gap: 7px;
}
.rfi-assignee-due > span {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.rfi-assignee-due input {
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 10.5px;
}
.rfi-assignee-due input:focus { border-color: var(--accent); outline: none; }
:root[data-theme="dark"] .rfi-assignee-due input { color-scheme: dark; }
:root[data-theme="light"] .rfi-assignee-due input { color-scheme: light; }
.rfi-assignee-remove {
  position: absolute;
  top: 7px;
  right: 5px;
  z-index: 2;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.rfi-assignee-remove:hover { background: var(--hover); color: var(--accent); }
.rfi-assignee-remove svg { width: 13px; height: 13px; }
.rfi-add-assignee {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 2px 0 0 30px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.rfi-add-assignee:hover { text-decoration: underline; }
.rfi-add-assignee svg { width: 14px; height: 14px; }
.rfi-overall-due {
  margin: 7px 0 0 30px;
  color: var(--text-muted);
  font-size: 10.5px;
}
.rfi-overall-due:empty { display: none; }

.rfi-editor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}
.rfi-editor-chips:empty { display: none; }

.rfi-people-results {
  max-height: 210px;
  margin-top: 5px;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow-y: auto;
}
.rfi-people-results:empty { display: none; }
.rfi-people-label {
  padding: 7px 10px 4px;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.rfi-person-result {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-top: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}
.rfi-person-result:hover { background: var(--hover); }
.rfi-person-result .mini-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  font-size: 10px;
}
.rfi-person-result > span:nth-child(2) {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rfi-person-result b { font-size: 12.5px; font-weight: 600; }
.rfi-person-result small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 10.5px;
}
.rfi-person-add {
  flex: none;
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.rfi-people-note {
  display: block;
  padding: 10px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.rfi-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}
.rfi-tool:hover { color: var(--accent); }
.rfi-tool svg { width: 14px; height: 14px; }
.rfi-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.rfi-attach-list:empty { display: none; }

/* rail badge */
.rail-count {
  position: absolute;
  top: 5px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--panel-2);
}

/* ---------- RFI / submittal PDF preview ---------- */
.rfi-export-modal {
  position: fixed;
  inset: 0;
  z-index: 480;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 15, 20, .6);
}
.rfi-export-modal[hidden] { display: none; }
.rfi-export-sheet {
  width: min(1040px, 96vw);
  height: min(94vh, 100%);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.rfi-export-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}
.rfi-export-bar b { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.rfi-export-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.rfi-export-project { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); }
.rfi-export-project[hidden] { display: none; }
.rfi-export-project > span { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.rfi-export-project select {
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.rfi-export-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.rfi-export-btn:hover { background: #06b78f; }
.rfi-export-btn.ghost { background: transparent; color: var(--text-muted); }
.rfi-export-btn.ghost:hover { background: var(--hover); color: var(--text); }
.rfi-export-sheet iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: #eef1f2; }
@media (max-width: 820px) {
  .rfi-export-modal { padding: 0; }
  .rfi-export-sheet { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .rfi-export-bar { padding: 8px 10px; }
}

/* ---------- read-only project viewer ---------- */
.rfi-readonly-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 12px 18px 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.rfi-readonly-icon { flex: none; display: flex; margin-top: 1px; }
.rfi-readonly-icon svg { width: 16px; height: 16px; color: var(--accent); }

/* ---------- distribute modal ---------- */
.rfi-distribute-modal { width: min(520px, 100%); }
.rfi-distribute-subject {
  margin: 0 24px 14px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.rfi-distribute-summary {
  margin: -6px 24px 14px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
}
.rfi-distribute-mode {
  display: grid;
  gap: 8px;
  margin: 0 24px 14px;
}
.rfi-distribute-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.rfi-distribute-option:hover { border-color: var(--accent); }
.rfi-distribute-option.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--panel-2));
}
.rfi-distribute-option input[type="radio"] {
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--accent);
}
.rfi-distribute-option-copy { display: flex; flex-direction: column; gap: 2px; }
.rfi-distribute-option-copy b { font-size: 13px; font-weight: 600; color: var(--text); }
.rfi-distribute-option-copy small { font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
.rfi-distribute-modal .rfi-editor-chips { margin: 0 24px 10px; }
.rfi-distribute-modal .rfi-people-results { margin: 0 24px 12px; max-height: 210px; }
.rfi-dist-alien {
  display: flex;
  gap: 8px;
  margin: 0 24px 12px;
}
.rfi-dist-alien input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.rfi-dist-alien input:focus {
  outline: none;
  border-color: var(--accent);
}
.rfi-dist-alien button {
  flex: none;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.rfi-dist-alien button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.rfi-editor-chip-alien {
  border-style: dashed;
}
.rfi-person-alien {
  border: 1px dashed var(--border);
  border-radius: 9px;
}
.rfi-person-alien .rfi-person-add:first-child {
  flex: none;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .7;
}
.rfi-distribute-error {
  margin: 0 24px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #f15c6d;
}
.rfi-distribute-error[hidden] { display: none; }

/* ============================================================
   Digital sign-off
   ============================================================ */
.rfi-signoff {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}
.rfi-signoff .rfi-label { margin-bottom: 8px; }
.rfi-signoff .rfi-muted { font-size: 12px; line-height: 1.5; color: var(--text-muted); margin: 0 0 10px; }
.rfi-signoff-card {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rfi-signature-img {
  max-width: 180px;
  max-height: 56px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.rfi-signoff-meta b { display: block; font-size: 12.5px; color: var(--text); }
.rfi-signoff-meta small { display: block; font-size: 11px; color: var(--text-muted); margin: 2px 0 5px; }
.rfi-signoff-meta .rfi-node-text { margin: 4px 0 0; font-size: 12px; color: var(--text); }

.signoff-modal { width: min(620px, 100%); }
.signoff-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.signoff-head span { font-size: 9.5px; letter-spacing: .1em; font-weight: 700; color: var(--text-muted); }
.signoff-head h2 { margin: 3px 0 0; font-size: 16px; font-weight: 600; }
.signoff-body { padding: 16px 20px; }
.signoff-body .field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: 12px; font-weight: 600; }
.signoff-body .field em { color: var(--text-muted); font-weight: 400; font-style: normal; }
.signoff-body textarea {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  resize: vertical;
}
.signoff-canvas {
  display: block;
  width: 100%;
  height: 180px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.signoff-canvas-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.signoff-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}
.signoff-footer button { padding: 8px 16px; font-size: 12.5px; border-radius: 6px; }
.signoff-footer .primary { background: var(--accent); color: #fff; border: 0; font-weight: 600; }
.signoff-footer .primary:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- global tooltip ---------- */
.app-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 900;
  max-width: min(300px, calc(100vw - 24px));
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: .01em;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: var(--tooltip-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(2px);
  transition: opacity .1s ease, transform .1s ease, visibility 0s linear .1s;
  pointer-events: none;
  user-select: none;
}
.app-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}
.app-tooltip[data-placement="bottom"] { transform: translateY(-2px); }
.app-tooltip[data-placement="bottom"].visible { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .app-tooltip { transition: none; }
}
/* ---------- daily site log module ---------- */
.daily-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.daily-view[hidden] { display: none; }

.daily-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}
.daily-back { display: none; }
.daily-head-copy { flex: 1; min-width: 0; }
.daily-head-copy h2 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.daily-head-copy p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.daily-head-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.daily-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.daily-primary:hover { background: #06b78f; }
.daily-primary:disabled { opacity: .55; cursor: progress; }
.daily-primary svg { width: 15px; height: 15px; }
.daily-cancel {
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.daily-cancel:hover { background: var(--hover); color: var(--text); }
.daily-head-actions .icon-btn.copied { color: var(--accent); }
.daily-head-actions .icon-btn.danger { color: #e0655a; }
.daily-head-actions .icon-btn.danger:hover { background: rgba(224, 101, 90, .12); }

.daily-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 28px 40px; }

.daily-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.daily-form-grid .daily-field { margin-top: 0; }
.daily-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.daily-field input,
.daily-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  text-transform: none;
  outline: none;
  resize: vertical;
}
.daily-field input:focus,
.daily-field textarea:focus { border-color: var(--accent); }

/* read-only record */
.daily-read-field { margin-top: 16px; }
.daily-read-field > span {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.daily-read-field > p {
  margin: 0;
  min-height: 20px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.daily-read-field > p em { color: var(--text-muted); font-style: normal; opacity: .7; }
.daily-form-grid .daily-read-field { margin-top: 0; }

.daily-attach-section,
.daily-activity {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.daily-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.daily-section-head h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.daily-section-head p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.daily-attach-actions { flex: none; display: flex; gap: 6px; }
.daily-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.daily-tool:hover { color: var(--accent); border-color: var(--accent); }
.daily-tool svg { width: 13px; height: 13px; }

/* In-flight attachment uploads: name, preparing/percentage and a moving bar. */
.daily-upload-list:empty { display: none; }
.daily-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
}
.daily-upload-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11.5px;
  color: var(--text);
}
.daily-upload-name svg { width: 14px; height: 14px; flex: none; color: var(--text-muted); }
.daily-upload-name span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.daily-upload-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.daily-upload .doc-progress { grid-column: 1 / -1; margin-top: 2px; }

/* Photos use a simple square-thumbnail grid; the +N tile reveals the overflow. */
.daily-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 4px;
  width: 100%;
  max-width: 100%;
  margin-top: 10px;
}
.daily-gallery:empty { display: none; }
.daily-gallery-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--chip);
  cursor: pointer;
}
.daily-gallery-tile img,
.daily-gallery-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.daily-gallery-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
}
.daily-gallery-play svg { width: 28px; height: 28px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); }
.daily-gallery-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.daily-gallery-tile.daily-gallery-extra { display: none; }
.daily-gallery.expanded .daily-gallery-extra { display: block; }
.daily-gallery-more {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: rgba(11, 20, 26, .62);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.daily-gallery-more:hover { background: rgba(11, 20, 26, .78); }
.daily-gallery.expanded .daily-gallery-more {
  inset: auto 6px 6px auto;
  width: auto;
  height: auto;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.daily-gallery-remove {
  position: absolute;
  z-index: 2;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(11, 20, 26, .66);
  color: #fff;
  cursor: pointer;
}
.daily-gallery-remove:hover { background: #b23b34; }
.daily-gallery-remove svg { width: 11px; height: 11px; }

.daily-attach-label {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.daily-attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.daily-attach-list:empty { display: none; }
.daily-attach-label + .daily-attach-list { margin-top: 6px; }
.daily-attach-item { position: relative; display: inline-flex; max-width: 100%; }
.daily-attach-item .attach-chip { padding-right: 26px; }
.daily-attach-remove {
  position: absolute;
  top: 50%;
  right: 3px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
}
.daily-attach-remove:hover { color: #e0655a; }
.daily-attach-remove svg { width: 11px; height: 11px; }

.daily-activity-count { flex: none; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.daily-timeline {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.daily-tl-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.daily-tl-row:last-child { border-bottom: 0; }
.daily-tl-time {
  padding-top: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.daily-tl-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.daily-tl-head b { font-weight: 600; color: var(--text); }
.daily-tl-head span { color: var(--text-muted); }
.daily-tl-body p {
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.daily-tl-media { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.daily-photo {
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--chip);
  cursor: pointer;
}
.daily-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.daily-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  margin-top: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11.5px;
  text-decoration: none;
}
.daily-file-link:hover { border-color: var(--accent); color: var(--accent); }
.daily-file-link svg { width: 13px; height: 13px; flex: none; }
.daily-file-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-activity-empty {
  margin-top: 10px;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

/* Foot-of-log provenance: the latest save plus a foldable trail of updates. */
.daily-history {
  margin: 26px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.daily-history-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.daily-history-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.daily-history-toggle .daily-activity-count { margin-left: auto; }
.daily-history-caret {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: transform .16s ease;
}
.daily-history-caret svg { width: 14px; height: 14px; }
.daily-history.open .daily-history-caret { transform: rotate(180deg); }
.daily-history-body { display: none; }
.daily-history.open .daily-history-body { display: block; }
.daily-saved-note {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}
.daily-history-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.daily-history-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}
.daily-history-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text-muted);
}
.daily-history-icon svg { width: 11px; height: 11px; }
.daily-history-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 6px; min-width: 0; }
.daily-history-copy b { font-weight: 600; color: var(--text); }
.daily-history-copy span { color: var(--text-muted); }
.daily-history-time {
  color: var(--text-muted);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.daily-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  background: var(--panel);
}
.daily-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}
.daily-empty-icon svg { width: 26px; height: 26px; }
.daily-empty h2 { margin: 0; font-size: 21px; font-weight: 600; }
.daily-empty p {
  max-width: 360px;
  margin: 6px 0 16px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.daily-create-modal { width: min(440px, 100%); }
.daily-create-body { padding-bottom: 8px; }
.daily-create-hint {
  margin: -4px 24px 16px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* sidebar list */
.daily-mobile-back { display: none; }
.daily-new-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: calc(100% - 24px);
  margin: 8px 12px 4px;
  padding: 9px 12px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.daily-new-row:hover { background: var(--accent-soft); border-color: var(--accent); }
.daily-new-row svg { width: 15px; height: 15px; }
.daily-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.daily-item:hover { background: var(--hover); }
.daily-item.selected { background: var(--hover); }
.daily-item-date {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 42px;
  padding: 4px 0;
  border-radius: 7px;
  background: var(--panel-2);
  line-height: 1;
}
.daily-item-date b { font-size: 16px; font-weight: 700; }
.daily-item-date small {
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.daily-item-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.daily-item-copy b {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.daily-item-copy b em {
  margin-left: 4px;
  font-style: normal;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
}
.daily-item-copy small {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* small popup launched from a chat message */
.push-daily-pop {
  width: 260px;
  min-width: 240px;
  padding: 10px;
}
.push-daily-head {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.push-daily-preview {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.push-daily-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.push-daily-field select {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  outline: none;
}
.push-daily-field select:focus { border-color: var(--accent); }
.push-daily-confirm {
  width: 100%;
  margin-top: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.push-daily-confirm:hover { background: #06b78f; }
.push-daily-confirm:disabled { opacity: .45; cursor: not-allowed; }

/* date block inside the shared project-filter popover */
.daily-filter-dates {
  padding: 8px 9px 7px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.daily-filter-dates[hidden] { display: none; }
.daily-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.daily-filter-head button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.daily-filter-date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.daily-filter-date-grid label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}
.daily-filter-date-grid input {
  width: 100%;
  padding: 6px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  outline: none;
}
.daily-filter-date-grid input:focus { border-color: var(--accent); }
.daily-filter-presets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.daily-filter-presets button {
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.daily-filter-presets button:hover { color: var(--accent); border-color: var(--accent); }

/* daily log requests */
.daily-requests-row {
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.daily-requests-row.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.daily-request-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  line-height: 20px;
  text-align: center;
}
.daily-request-list { display: flex; flex-direction: column; gap: 12px; }
.daily-request-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}
.daily-request-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.daily-request-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.daily-request-copy b { font-size: 13px; font-weight: 600; color: var(--text); }
.daily-request-copy small { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.daily-request-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.daily-request-actions .daily-primary,
.daily-request-actions .daily-cancel { padding: 8px 12px; font-size: 12px; }

@media (max-width: 820px) {
  .daily-mobile-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 4px;
  }
  .daily-mobile-back button {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--accent);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
  }
  .daily-mobile-back button:hover { background: var(--hover); }
  .daily-mobile-back button svg { width: 15px; height: 15px; }
  .daily-mobile-back b { margin-left: auto; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
  .daily-back { display: grid; }
  .daily-head { padding: 10px 12px; gap: 8px; }
  .daily-head-copy h2 { font-size: 16px; }
  .daily-scroll { padding: 14px 12px 28px; }
  .daily-form-grid { grid-template-columns: 1fr; }
  .daily-history-item { grid-template-columns: 20px minmax(0, 1fr); }
  .daily-history-time { grid-column: 2; grid-row: 2; }
  .daily-tl-row { grid-template-columns: 54px minmax(0, 1fr); }
  .daily-head-actions .daily-primary { padding: 8px 12px; }
  .daily-request-card { flex-direction: column; align-items: stretch; }
  .daily-request-actions { justify-content: flex-end; }
}
/* ---------- settings module (rail list + full-page sections) ---------- */
.settings-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.settings-view[hidden] { display: none; }

.settings-head {
  flex: none;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}
.settings-back-btn { display: none; }
.settings-head-copy { flex: 1; min-width: 0; }
.settings-head-copy h2 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px 24px 48px;
}
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 760px;
  margin: 0;
}
/* Cards were removed from settings: sections sit directly on the page and
   line up with the section title in the header above. */
.settings-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.settings-card-head { margin-bottom: 18px; }
.settings-card-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}
.settings-card-head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}
.settings-row,
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.settings-row:first-of-type,
.settings-toggle-row:first-of-type {
  padding-top: 0;
  border-top: 0;
}
.settings-row b,
.settings-toggle-copy b {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.settings-row small,
.settings-toggle-copy small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
.settings-toggle-copy { min-width: 0; }
.settings-toggle-row { align-items: flex-start; }

.settings-primary {
  padding: 9px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.settings-primary:hover { background: #06b78f; }
.settings-primary:disabled { opacity: .55; cursor: progress; }
.settings-secondary {
  flex: none;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.settings-secondary:hover { border-color: var(--accent); color: var(--accent); }
.settings-secondary:disabled { opacity: .5; cursor: default; }
.settings-danger {
  flex: none;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: #e0655a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.settings-danger:hover { border-color: #e0655a; }
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- backups ---------- */
.settings-backup-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0 14px;
}
.settings-backup-state {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.settings-backup-state b { font-size: 14px; font-weight: 650; }
.settings-backup-state small {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
.settings-backup-state .settings-backup-error { color: #e0655a; }
.settings-backup-list { display: flex; flex-direction: column; }
.settings-backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.settings-backup-copy { min-width: 0; }
.settings-backup-copy b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.settings-backup-copy small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.settings-backup-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-backup-actions a.settings-secondary {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.settings-backup-restore {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.settings-backup-restore b { font-size: 13px; font-weight: 600; }
.settings-backup-restore code {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-soft, var(--text));
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: nowrap;
}
.settings-backup-dest small strong { font-weight: 600; color: var(--text); }
.settings-backup-dest .settings-backup-error,
.settings-backup-key .settings-backup-error { color: #e0655a; }
.settings-backup-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}
.settings-backup-picker select {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}
.settings-backup-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.settings-backup-crumb {
  padding: 3px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.settings-backup-crumb:last-of-type { color: var(--text); font-weight: 600; }
.settings-backup-crumb:hover { background: var(--hover, rgba(127,127,127,.12)); }
.settings-backup-folders {
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
}
.settings-backup-folders .settings-note,
.settings-backup-folders .settings-error { margin: 0; padding: 12px; }
.settings-backup-folder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.settings-backup-folder:first-child { border-top: 0; }
.settings-backup-folder:hover { background: var(--hover, rgba(127,127,127,.12)); }
.settings-backup-newfolder { display: flex; gap: 8px; }
.settings-backup-newfolder input { flex: 1; min-width: 0; }
.settings-backup-picker-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.settings-backup-keybox { margin-top: 0; padding-top: 0; border-top: 0; }
.settings-backup-keybox code { user-select: all; }
.settings-backup-state b { display: inline-flex; align-items: center; gap: 8px; }
.settings-backup-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.settings-backup-dot.is-ok { background: #25b07a; }
.settings-backup-dot.is-warn { background: #e0a33a; }
.settings-backup-dot.is-bad { background: #e0655a; }
.settings-backup-dot.is-busy { background: var(--accent); animation: settings-backup-pulse 1.2s ease-in-out infinite; }
@keyframes settings-backup-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .settings-backup-dot.is-busy { animation: none; } }
.settings-backup-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
}
.settings-backup-facts > div {
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel-2);
}
.settings-backup-facts dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-muted);
}
.settings-backup-facts dd {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text);
}
.settings-backup-pill {
  display: inline-block;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(37, 176, 122, .14);
  color: #1f9a6a;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
}
.settings-backup-pill.is-legacy { background: rgba(127, 127, 127, .14); color: var(--text-muted); }
.settings-backup-copy .settings-backup-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  opacity: .8;
}
.settings-backup-more {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.settings-backup-list .settings-backup-row:first-child { border-top: 0; }
.settings-backup-code {
  display: block;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: nowrap;
}
.settings-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}
.settings-backup-legacy { margin: 0 0 10px; }
@media (max-width: 560px) {
  .settings-backup-status { flex-direction: column; }
  .settings-backup-facts { grid-template-columns: 1fr; }
  .settings-backup-row { flex-direction: column; align-items: flex-start; }
  .settings-backup-actions { width: 100%; }
  .settings-backup-newfolder { flex-direction: column; }
  .settings-backup-picker-actions { justify-content: stretch; }
  .settings-backup-picker-actions button { flex: 1; }
}
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
}
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.settings-field em {
  font-style: normal;
  font-weight: 400;
  opacity: .75;
}
.settings-field input,
.settings-inline-form input {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}
.settings-field input:focus,
.settings-inline-form input:focus { border-color: var(--accent); }
.settings-error {
  margin: 0;
  font-size: 12px;
  color: #e0655a;
}
.settings-note {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
}
.settings-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text);
}
.settings-check input {
  margin: 2px 0 0;
  accent-color: var(--accent);
}
.settings-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.settings-inline-form input { flex: 1; min-width: 180px; }

.settings-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 6px;
}
.settings-avatar-lg {
  width: 64px;
  height: 64px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel-2);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
}
.settings-avatar-lg img,
.settings-person-avatar img,
.settings-nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.settings-avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.settings-switch {
  position: relative;
  flex: none;
  width: 40px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
}
.settings-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s ease;
}
.settings-switch.on { background: var(--accent); }
.settings-switch.on span { transform: translateX(17px); }
.settings-switch:disabled { opacity: .45; cursor: not-allowed; }
.settings-toggle-row.is-unavailable .settings-toggle-copy { opacity: .6; }

.settings-badge {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}
.settings-badge.on {
  background: var(--accent-soft);
  color: var(--accent);
}
.settings-person em {
  margin-left: 4px;
  font-style: normal;
  font-size: 10px;
  color: var(--text-muted);
}

.settings-list { display: flex; flex-direction: column; }
.settings-person,
.settings-project {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.settings-person:first-child,
.settings-project:first-child {
  padding-top: 0;
  border-top: 0;
}
.settings-person-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.settings-person-copy,
.settings-project-copy { flex: 1; min-width: 0; }
.settings-person-copy b,
.settings-project-copy b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-person-copy small,
.settings-project-copy small {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-project-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}
.settings-project-icon svg { width: 18px; height: 18px; }
.settings-project-dates {
  flex: none;
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.settings-dept-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.settings-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  background: var(--panel-2);
}
.settings-chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.settings-chip button:hover { color: #e0655a; background: var(--hover); }
.settings-chip button svg { width: 11px; height: 11px; }

.settings-tone { display: flex; align-items: center; gap: 8px; }
.settings-tone select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
/* The preview buttons hold only ICONS.play, an SVG with no width/height. Give
   it an explicit size and centre it so the buttons don't render blank. */
.settings-tone .settings-secondary {
  display: inline-grid;
  place-items: center;
  padding: 7px;
}
.settings-tone .settings-secondary svg { width: 15px; height: 15px; display: block; }
.settings-loading-card {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* sidebar section list (rendered into #chatList) */
.settings-nav { padding: 8px 0 20px; }
.settings-nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 4px 12px 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.settings-nav-user:hover { border-color: var(--accent); }
.settings-nav-avatar {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.settings-nav-user-copy { min-width: 0; }
.settings-nav-user-copy b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-nav-user-copy small {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-nav-group { margin-top: 6px; }
.settings-nav-label {
  display: block;
  padding: 8px 22px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 1px 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.settings-nav-item:hover { background: var(--hover); }
.settings-nav-item.active { background: var(--accent-soft); color: var(--accent); }
.settings-nav-icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.settings-nav-item.active .settings-nav-icon { color: var(--accent); }
.settings-nav-icon svg { width: 18px; height: 18px; }
.settings-nav-copy { flex: 1; min-width: 0; }
.settings-nav-copy b { display: block; font-size: 12.5px; font-weight: 600; }
.settings-nav-arrow {
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.settings-nav-arrow svg { width: 14px; height: 14px; }

@media (max-width: 820px) {
  .settings-head { min-height: 64px; padding: 10px 14px; gap: 8px; }
  .settings-head-copy h2 { font-size: 19px; }
  .settings-back-btn { display: grid; }
  .settings-scroll { padding: 18px 14px 40px; }
  .settings-card { padding: 0; }
  .settings-stack { gap: 28px; }
  .settings-card-head { margin-bottom: 16px; }
  .settings-card-head h3 { font-size: 17px; }
  .settings-card-head p { font-size: 13px; }
  .settings-row,
  .settings-toggle-row { gap: 12px; padding: 15px 0; }
  .settings-row b,
  .settings-toggle-copy b { font-size: 14px; }
  .settings-row small,
  .settings-toggle-copy small { font-size: 12.5px; }
  .settings-note { font-size: 12.5px; }
  .settings-field { font-size: 12.5px; }
  .settings-field input,
  .settings-inline-form input,
  .settings-tone select { font-size: 14px; }
  .settings-primary,
  .settings-secondary,
  .settings-danger { font-size: 13px; }
  .settings-nav-copy b { font-size: 13.5px; }
  .settings-person,
  .settings-project { gap: 9px; }
  .settings-project-dates { display: none; }
}

/* ---------- member directory / staff tools ---------- */
.settings-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.settings-toolbar-search {
  flex: 1;
  min-width: 180px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.settings-toolbar-search:focus { border-color: var(--accent); }
.settings-toolbar select {
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.settings-toolbar select:focus { border-color: var(--accent); }

.settings-member {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.settings-list .settings-member:first-child { border-top: 0; }
.settings-member:hover { background: var(--hover); }
.settings-member-copy { flex: 1; min-width: 0; }
.settings-member-copy b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-member-copy small {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-member-dept {
  flex: none;
  max-width: 160px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-invite-card {
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}
.settings-invite-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.settings-invite-head b { display: block; font-size: 13px; }
.settings-invite-head small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }
.settings-icon-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.settings-icon-btn:hover { background: var(--hover); color: var(--text); }
.settings-icon-btn svg { width: 14px; height: 14px; }
.settings-invite-link {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.settings-invite-link input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}
.settings-back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.settings-back-link svg { width: 15px; height: 15px; }
.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.settings-form-grid .settings-field { min-width: 0; }
.settings-field select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}
.settings-field select:focus { border-color: var(--accent); }

.settings-member-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.settings-member-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.settings-member-head p { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.settings-member-head > div { flex: 1; min-width: 140px; }

.settings-project-picker {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.settings-project-picker .settings-check { margin: 0; font-size: 12.5px; }
.settings-project-picker .settings-check small { margin-left: 4px; color: var(--text-muted); font-size: 10.5px; }

.settings-directory-group { margin-top: 14px; }
.settings-directory-group:first-child { margin-top: 0; }
.settings-directory-group + .settings-directory-group {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.settings-directory-group h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.settings-directory-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.settings-directory-group .settings-directory-row:first-of-type { border-top: 0; }

.settings-audit-list { display: flex; flex-direction: column; }
.settings-audit-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.settings-audit-row:first-child { border-top: 0; padding-top: 0; }
.settings-audit-time { flex: none; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }

@media (max-width: 820px) {
  .settings-toolbar-search { flex-basis: 100%; }
  .settings-toolbar select { flex: 1; min-width: 0; }
  .settings-member-dept { display: none; }
  .settings-form-grid { grid-template-columns: 1fr; }
  .settings-member { gap: 8px; }
  .settings-member .settings-badge { display: none; }
  .settings-invite-link { flex-direction: column; }
}

/* profile facts */
.settings-profile-facts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.settings-profile-fact {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}
.settings-profile-fact span { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.settings-profile-fact b { min-width: 0; font-size: 13.5px; font-weight: 600; line-height: 1.4; text-align: right; }
/* A little more air through the Profile section: the photo row, upload hint
   and read-only facts used to sit tightly stacked on desktop. */
.settings-profile-body .settings-avatar-row { margin-bottom: 12px; }
.settings-profile-body .settings-avatar-row + .attach-hint { margin-bottom: 14px; }
.settings-profile-body .settings-profile-facts { gap: 12px; margin-bottom: 22px; }
.settings-profile-body .settings-profile-fact { padding: 14px 16px; }
.settings-profile-body .settings-form { gap: 14px; margin-top: 18px; }

.settings-subhead {
  margin: 28px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.settings-subhead:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
/* Forms already space their children with a flex gap. */
.settings-form .settings-subhead { margin-top: 12px; margin-bottom: 0; }
.settings-form .settings-subhead:first-child { margin-top: 0; }
/* The divider above a heading already separates the block, so the control
   right underneath it does not need a rule of its own. */
.settings-subhead + .settings-toggle-row,
.settings-subhead + .settings-row { border-top: 0; padding-top: 2px; }

.settings-password-form {
  margin: 6px 0 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

/* company branding */
.settings-company-logo { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.settings-company-mark {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: var(--panel);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}
.settings-company-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

/* departments */
.settings-dept-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.settings-dept-row + .settings-dept-row { margin-top: 8px; }
.settings-dept-row:hover { border-color: var(--accent); }
.settings-dept-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.settings-dept-icon svg { width: 18px; height: 18px; }
.settings-dept-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-dept-copy b { font-size: 14px; font-weight: 600; }
.settings-dept-copy small { font-size: 12px; color: var(--text-muted); }
.settings-dept-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.settings-dept-detail-head h3 { margin: 0 0 3px; font-size: 18px; font-weight: 650; }
.settings-dept-detail-head p { margin: 0; color: var(--text-muted); font-size: 13px; }
.settings-dept-manager { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); margin-bottom: 8px; }
.settings-dept-manager > span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.settings-dept-manager .settings-dept-person { padding-top: 0; border-top: 0; }
.settings-dept-person { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.settings-dept-person:first-child { border-top: 0; }
.settings-dept-person b { display: block; font-size: 13.5px; }
.settings-dept-person b em { font-style: normal; font-size: 10px; font-weight: 700; color: var(--accent); margin-left: 5px; text-transform: uppercase; letter-spacing: .05em; }
.settings-dept-person small { color: var(--text-muted); font-size: 12px; }
.settings-dept-members { display: flex; flex-direction: column; }

/* theme style picker */
.settings-theme-select {
  min-width: 170px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.settings-theme-select:hover { border-color: var(--accent); }
.settings-theme-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* time & date preview */
.settings-clock-preview {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
}

/* font family sample (inherits the chosen app font) */
.settings-font-sample {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* API tokens (Settings → Integrations) */
.settings-token-form { margin-bottom: 14px; }
.settings-token-list { display: flex; flex-direction: column; }
.settings-token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  border-top: 1px solid var(--border);
}
.settings-token-row:first-child { border-top: 0; }
.settings-token-copy { flex: 1; min-width: 0; }
.settings-token-copy b { display: block; font-size: 13px; }
.settings-token-copy small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.settings-token-copy code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--panel-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
@media (max-width: 820px) {
  .settings-token-row { flex-direction: column; align-items: flex-start; }
}

/* ---------- People → external member: what can this person see ---------- */
.settings-access-checks { display: flex; flex-direction: column; }
.settings-check.settings-access-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.settings-access-checks .settings-access-check:first-child { border-top: 0; padding-top: 2px; }
.settings-access-check input { margin-top: 2px; flex: none; }
.settings-access-check span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-access-check b { font-size: 13px; font-weight: 600; color: var(--text); }
.settings-access-check small { font-size: 11.5px; line-height: 1.4; color: var(--text-muted); font-weight: 400; }

/* =====================================================================
   Settings design pass (2026-11-30): spacious, calm rhythm modelled on
   Settings → Backups. Later rules here override the base styles above;
   theme files (19-playful, 25-corporate, 30-cobalt2) still apply after.
   ===================================================================== */
.settings-scroll { padding: 40px 44px 80px; }
.settings-stack { gap: 52px; max-width: 720px; }

/* Section titles: sentence case, one size, a quiet hint underneath. */
.settings-card-head { margin-bottom: 22px; }
.settings-card-head h3 { font-size: 17px; font-weight: 650; letter-spacing: -.005em; }
.settings-card-head p { margin-top: 6px; font-size: 13px; line-height: 1.55; }
.settings-card-head:not(:has(h3)) p { margin-top: 0; }
.settings-subhead,
.settings-form .settings-subhead {
  margin: 44px 0 6px;
  padding: 0;
  border: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}
.settings-subhead small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-muted);
}
.settings-subhead:first-child,
.settings-form .settings-subhead:first-child { margin-top: 0; }
.settings-form .settings-subhead { margin-top: 28px; }

/* Rows: more air between label, description and the next row. */
.settings-row,
.settings-toggle-row { gap: 28px; padding: 20px 0; }
.settings-row:first-of-type,
.settings-toggle-row:first-of-type { padding-top: 6px; }
.settings-row b,
.settings-toggle-copy b { font-size: 14px; line-height: 1.35; }
.settings-row small,
.settings-toggle-copy small { margin-top: 5px; font-size: 12.5px; line-height: 1.55; }
.settings-subhead + .settings-toggle-row,
.settings-subhead + .settings-row,
.settings-subhead + label.settings-toggle-row { padding-top: 12px; border-top: 0; }

/* Notes and actions. */
.settings-note { margin-top: 16px; font-size: 12.5px; line-height: 1.6; }
.settings-actions { margin-top: 36px; gap: 10px; }
.settings-primary { padding: 10px 18px; border-radius: 10px; font-size: 13px; }
.settings-secondary,
.settings-danger { padding: 8px 14px; border-radius: 9px; font-size: 12.5px; }

/* Forms: comfortable fields with clear gaps. */
.settings-form { gap: 22px; }
.settings-form-grid { gap: 18px; }
.settings-field { gap: 8px; font-size: 12.5px; }
.settings-field input,
.settings-inline-form input,
.settings-field select {
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 14px;
}
.settings-field em { font-weight: 400; }

/* Profile / company header: avatar or logo, then breathing room. */
.settings-profile-body .settings-avatar-row,
.settings-company-logo { margin-bottom: 30px; }
.settings-profile-body .settings-form { gap: 22px; margin-top: 34px; }

/* Department / projects: a light facts strip, like the Backups summary. */
.settings-profile-body .settings-profile-facts,
.settings-profile-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--border);
}
.settings-profile-body .settings-profile-fact,
.settings-profile-fact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: var(--panel-2);
}
.settings-profile-fact span {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.settings-profile-fact b { font-size: 13.5px; text-align: left; }

/* Lists: rows divided by hairlines instead of boxed cards. */
.settings-dept-row {
  padding: 16px 6px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
.settings-dept-row:first-child { border-top: 0; }
.settings-dept-row + .settings-dept-row { margin-top: 0; }
.settings-dept-row:hover { background: var(--hover, rgba(127, 127, 127, .06)); border-color: var(--border); }
.settings-member { padding-top: 14px; padding-bottom: 14px; }
.settings-toolbar { margin-bottom: 18px; }
.settings-audit-row { padding: 14px 0; }
.settings-token-list { margin-top: 28px; }

/* IT switches: checkboxes styled as the app's switch, whole row clickable. */
label.settings-check-switch { cursor: pointer; }
.settings-check-switch input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 40px;
  height: 23px;
  margin: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: background .15s ease;
}
.settings-check-switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s ease;
}
.settings-check-switch input:checked { background: var(--accent); }
.settings-check-switch input:checked::after { transform: translateX(17px); }
.settings-check-switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 820px) {
  .settings-scroll { padding: 24px 18px 56px; }
  .settings-stack { gap: 40px; }
  .settings-row,
  .settings-toggle-row { gap: 16px; padding: 18px 0; }
  .settings-subhead,
  .settings-form .settings-subhead { margin-top: 32px; }
}
@media (max-width: 560px) {
  .settings-profile-body .settings-profile-facts,
  .settings-profile-facts { grid-template-columns: 1fr; }
}

/* Design pass — follow-up fixes from the screenshots. */
.settings-profile-body .settings-profile-fact,
.settings-profile-fact { justify-content: flex-start; }
.settings-form > .settings-check-switch { margin-top: -22px; padding: 18px 0; }
.settings-form > .settings-subhead + .settings-check-switch { margin-top: -10px; padding-top: 6px; }
.settings-form .settings-actions { margin-top: 14px; }
.settings-font-sample { margin-bottom: 8px; }
.settings-list > .settings-dept-row:first-child { padding-top: 6px; }
/* Playful draws rows as 8px-spaced bubbles; inside a form, cancel the form's
   22px flex gap so the IT switches space like every other Playful row. */
:root[data-theme-style="playful"] .settings-form > .settings-check-switch { margin-top: -14px; }
/* ============================================================
   Playful theme — opt-in via Settings → Appearance.
   Candy colours, big soft corners, springy hover states and
   bubbles that pop into place. The information architecture is
   unchanged; only the paint and motion get a little more fun.
   ============================================================ */

:root[data-theme-style="playful"][data-theme="light"] {
  --app-bg: #fff3f9;
  --panel: #fffafd;
  --panel-2: #ffedf6;
  --header: #fff5fa;
  --text: #432a4a;
  --text-soft: #5d4366;
  --text-muted: #97769f;
  --border: #ffdcec;
  --accent: #ff5c8a;
  --accent-soft: rgba(255, 92, 138, .16);
  --bubble-out: #ffd7e9;
  --bubble-in: #ffffff;
  --attach-bg: rgba(255, 92, 138, .10);
  --meta: rgba(67, 42, 74, .55);
  --tick-read: #8a5cff;
  --wallpaper: #fff6fb;
  --wallpaper-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='%23ff5c8a' fill-opacity='.10'%3E%3Ccircle cx='24' cy='26' r='5'/%3E%3Cpath d='M132 18l4 8 9 1-7 6 2 9-8-4-8 4 2-9-7-6 9-1z'/%3E%3C/g%3E%3Cg fill='%238a5cff' fill-opacity='.10'%3E%3Ccircle cx='118' cy='124' r='6'/%3E%3Crect x='36' y='130' width='9' height='9' rx='2' transform='rotate(20 40 134)'/%3E%3C/g%3E%3Cg fill='%23ffb020' fill-opacity='.12'%3E%3Ccircle cx='82' cy='76' r='4'/%3E%3Cpath d='M156 88l3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1z'/%3E%3C/g%3E%3Cg fill='%2300c2a8' fill-opacity='.10'%3E%3Ccircle cx='46' cy='86' r='4'/%3E%3Ccircle cx='154' cy='150' r='5'/%3E%3C/g%3E%3C/svg%3E");
  --hover: #fff0f7;
  --active: #ffe4f1;
  --input-bg: #ffffff;
  --search-bg: #fff0f7;
  --scroll: rgba(255, 92, 138, .30);
  --chip: rgba(255, 255, 255, .94);
  --shadow: 0 14px 34px rgba(180, 80, 130, .16);
  --tooltip-bg: #432a4a;
  --tooltip-text: #ffffff;
  --tooltip-shadow: 0 12px 32px rgba(67, 42, 74, .22);
  --author-name-1: #d63384;
  --author-name-2: #e0533d;
  --author-name-3: #0f9d76;
  --author-name-4: #7a4ce0;
  --author-name-5: #2563c9;
  --author-name-6: #b53d8f;
}

:root[data-theme-style="playful"][data-theme="dark"] {
  --app-bg: #130d1f;
  --panel: #1d1330;
  --panel-2: #281a40;
  --header: #22163a;
  --text: #f7edff;
  --text-soft: #decbf2;
  --text-muted: #a98fc4;
  --border: #372350;
  --accent: #ff8fb3;
  --accent-soft: rgba(255, 143, 179, .18);
  --bubble-out: #5a2b60;
  --bubble-in: #2a1c42;
  --attach-bg: rgba(255, 143, 179, .12);
  --meta: rgba(247, 237, 255, .60);
  --tick-read: #bda9ff;
  --wallpaper: #180f2a;
  --wallpaper-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='%23ff8fb3' fill-opacity='.07'%3E%3Ccircle cx='24' cy='26' r='5'/%3E%3Cpath d='M132 18l4 8 9 1-7 6 2 9-8-4-8 4 2-9-7-6 9-1z'/%3E%3C/g%3E%3Cg fill='%23bda9ff' fill-opacity='.07'%3E%3Ccircle cx='118' cy='124' r='6'/%3E%3Crect x='36' y='130' width='9' height='9' rx='2' transform='rotate(20 40 134)'/%3E%3C/g%3E%3Cg fill='%23ffd166' fill-opacity='.08'%3E%3Ccircle cx='82' cy='76' r='4'/%3E%3Cpath d='M156 88l3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1z'/%3E%3C/g%3E%3Cg fill='%235be0c0' fill-opacity='.07'%3E%3Ccircle cx='46' cy='86' r='4'/%3E%3Ccircle cx='154' cy='150' r='5'/%3E%3C/g%3E%3C/svg%3E");
  --hover: #2a1c42;
  --active: #362450;
  --input-bg: #2a1c42;
  --search-bg: #241738;
  --scroll: rgba(189, 169, 255, .35);
  --chip: rgba(42, 28, 66, .94);
  --shadow: 0 16px 42px rgba(0, 0, 0, .52);
  --tooltip-bg: #f7edff;
  --tooltip-text: #1d1330;
  --tooltip-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}

/* ---------- canvas & type ---------- */

:root[data-theme-style="playful"] body {
  font-family: var(--app-font, "Segoe UI Rounded", "SF Pro Rounded", ui-rounded, "Nunito", "Quicksand", "Segoe UI", system-ui, sans-serif);
}

:root[data-theme-style="playful"][data-theme="light"] body {
  background:
    radial-gradient(1100px 760px at 0% 0%, #ffe1ef, transparent 60%),
    radial-gradient(1000px 720px at 100% 100%, #e7dcff, transparent 58%),
    var(--app-bg);
  background-attachment: fixed;
}
:root[data-theme-style="playful"][data-theme="dark"] body {
  background:
    radial-gradient(1100px 760px at 0% 0%, #2c1740, transparent 60%),
    radial-gradient(1000px 720px at 100% 100%, #1b1746, transparent 58%),
    var(--app-bg);
  background-attachment: fixed;
}

:root[data-theme-style="playful"] .app { background: var(--panel); }

/* Candy gradient across the two top bars and the composer. */
:root[data-theme-style="playful"] .side-header,
:root[data-theme-style="playful"] .chat-header,
:root[data-theme-style="playful"] .composer {
  background: linear-gradient(115deg,
    color-mix(in srgb, var(--accent) 12%, var(--header)),
    var(--header) 55%,
    color-mix(in srgb, #8a5cff 10%, var(--header)));
  border-color: color-mix(in srgb, var(--accent) 20%, var(--border));
}

:root[data-theme-style="playful"] .sidebar {
  border-right-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}

/* Living wallpaper: the confetti pattern plus two slow drifting glows. */
:root[data-theme-style="playful"] .chat-panel {
  overflow: hidden;
  background-image:
    var(--wallpaper-pattern),
    radial-gradient(720px 520px at 88% -8%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    radial-gradient(620px 460px at -6% 104%, rgba(138, 92, 255, .11), transparent 70%);
}
:root[data-theme-style="playful"] .chat-panel:has(> .chat:not([hidden]))::before {
  content: "";
  position: absolute;
  inset: -14%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(240px 240px at 22% 28%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(280px 280px at 78% 72%, rgba(138, 92, 255, .13), transparent 70%);
  animation: pf-drift 22s ease-in-out infinite alternate;
}
:root[data-theme-style="playful"] .chat { position: relative; z-index: 1; }

@keyframes pf-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

/* ---------- shapes ---------- */

:root[data-theme-style="playful"] .search-box {
  border-radius: 999px;
  background: var(--search-bg);
  border: 2px solid transparent;
  transition: border-color .18s ease, box-shadow .18s ease;
}
:root[data-theme-style="playful"] .search-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}

:root[data-theme-style="playful"] .filter {
  font-weight: 600;
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .18s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .filter:hover { transform: translateY(-1px) scale(1.03); }
:root[data-theme-style="playful"] .filter.active {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 20%, var(--panel)),
    color-mix(in srgb, #8a5cff 18%, var(--panel)));
  border-color: transparent;
  color: var(--text);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 22%, transparent);
}

:root[data-theme-style="playful"] .chat-item {
  border-radius: 18px;
  transition: background .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease;
}
:root[data-theme-style="playful"] .chat-item:hover {
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  transform: translateX(2px) scale(1.008);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 14%, transparent);
}
:root[data-theme-style="playful"] .chat-item:active { transform: scale(.985); }
:root[data-theme-style="playful"] .chat-item.active {
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--accent) 17%, var(--panel)),
    color-mix(in srgb, #8a5cff 14%, var(--panel)));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 18%, transparent);
}
:root[data-theme-style="playful"] .chat-item .avatar {
  transition: transform .24s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .chat-item:hover .avatar {
  transform: rotate(-5deg) scale(1.07);
}

:root[data-theme-style="playful"] .icon-btn {
  transition: background .15s ease, color .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .icon-btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  transform: scale(1.08) rotate(-3deg);
}
:root[data-theme-style="playful"] .icon-btn:active { transform: scale(.92); }

:root[data-theme-style="playful"] #newChatBtn {
  background: linear-gradient(135deg, #ff5c8a, #8a5cff);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 92, 138, .38);
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .18s ease, filter .18s ease;
}
:root[data-theme-style="playful"] #newChatBtn:hover {
  background: linear-gradient(135deg, #ff709b, #9a72ff);
  color: #fff;
  transform: rotate(-8deg) scale(1.08);
  box-shadow: 0 8px 22px rgba(138, 92, 255, .42);
}
:root[data-theme-style="playful"] #newChatBtn:active { transform: scale(.94); }

/* ---------- rail ---------- */

:root[data-theme-style="playful"] .rail {
  border-right-color: color-mix(in srgb, var(--accent) 20%, var(--border));
}
:root[data-theme-style="playful"] .rail-btn {
  border-radius: 17px;
  transition: background .15s ease, color .15s ease, transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease;
}
:root[data-theme-style="playful"]:not(.rail-expanded) .rail-btn:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--mod) 24%, transparent);
}
:root[data-theme-style="playful"] .rail-btn:hover svg { animation: pf-wiggle .55s ease; }
:root[data-theme-style="playful"] .rail-btn:active { transform: scale(.94); }
:root[data-theme-style="playful"] .rail-btn.active svg { animation: pf-bob .5s cubic-bezier(.34, 1.56, .64, 1); }
:root[data-theme-style="playful"] .rail-btn.active {
  border-radius: 17px;
  box-shadow: 0 8px 18px -8px var(--mod);
}
:root[data-theme-style="playful"]:not(.rail-expanded) .rail-btn.active { transform: scale(1.04); }
:root[data-theme-style="playful"] .rail-sep {
  background: color-mix(in srgb, var(--accent) 38%, transparent);
}

@keyframes pf-wiggle {
  0%, 100% { transform: rotate(0) scale(1); }
  30% { transform: rotate(-9deg) scale(1.08); }
  65% { transform: rotate(7deg) scale(1.04); }
}
@keyframes pf-bob {
  0% { transform: scale(.8) rotate(-8deg); }
  55% { transform: scale(1.16) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- messages ---------- */

:root[data-theme-style="playful"] .messages { padding-top: 18px; }
:root[data-theme-style="playful"] .day-chip {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .2px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 18%, var(--chip)),
    color-mix(in srgb, #8a5cff 14%, var(--chip)));
  color: var(--text);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 16%, transparent);
}

:root[data-theme-style="playful"] .bubble {
  border-radius: 20px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 10%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
}
:root[data-theme-style="playful"] .bubble.out {
  border-top-right-radius: 6px;
  background: var(--bubble-out);
}
:root[data-theme-style="playful"] .bubble.in {
  border-top-left-radius: 6px;
  background: var(--bubble-in);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 8%, transparent), 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
}
:root[data-theme-style="playful"] .bubble.tail.out { border-top-right-radius: 6px; }
:root[data-theme-style="playful"] .bubble.tail.in { border-top-left-radius: 6px; }
:root[data-theme-style="playful"] .bubble.tail.out::after {
  border-radius: 0 0 4px 0;
  background: var(--bubble-out);
}
:root[data-theme-style="playful"] .bubble.tail.in::after {
  border-radius: 0 0 0 4px;
  background: var(--bubble-in);
}
:root[data-theme-style="playful"] .msg-row:hover .bubble {
  box-shadow: 0 6px 16px color-mix(in srgb, var(--text) 12%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
}
:root[data-theme-style="playful"] .msg-avatar {
  transition: transform .24s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .msg-avatar:hover { transform: rotate(-7deg) scale(1.16); }

/* Only the newest few rows pop when the list is repainted, so loading old
   pages and background syncs do not set the whole conversation dancing. */
:root[data-theme-style="playful"] .messages > .msg-row:nth-last-child(-n+3) {
  animation: pf-pop .42s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
@keyframes pf-pop {
  0% { opacity: 0; transform: translateY(10px) scale(.86); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Candy typing dots and reaction pills. */
:root[data-theme-style="playful"] .tdot { background: var(--accent); }
:root[data-theme-style="playful"] .tdot:nth-child(2) { background: #8a5cff; }
:root[data-theme-style="playful"] .tdot:nth-child(3) { background: #ffb020; }
:root[data-theme-style="playful"] .reaction-pill {
  border-radius: 999px;
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), background .15s ease;
}
:root[data-theme-style="playful"] .reaction-pill:hover {
  transform: translateY(-2px) scale(1.1) rotate(-3deg);
  background: color-mix(in srgb, var(--accent) 12%, var(--chip));
}
:root[data-theme-style="playful"] .reaction-pill.mine {
  background: color-mix(in srgb, var(--accent) 16%, var(--chip));
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

/* Rainbow scrollbars, just for fun. */
:root[data-theme-style="playful"] .chat-list::-webkit-scrollbar-thumb,
:root[data-theme-style="playful"] .messages::-webkit-scrollbar-thumb,
:root[data-theme-style="playful"] .settings-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff5c8a, #8a5cff);
  border-radius: 999px;
}

:root[data-theme-style="playful"] .messages-empty {
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 16%, var(--chip)),
    color-mix(in srgb, #8a5cff 12%, var(--chip)));
}
:root[data-theme-style="playful"] .load-earlier {
  border-radius: 999px;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--text);
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), background .15s ease;
}
:root[data-theme-style="playful"] .load-earlier:hover {
  background: color-mix(in srgb, var(--accent) 20%, var(--panel));
  transform: translateY(-1px);
}

/* ---------- composer ---------- */

:root[data-theme-style="playful"] .composer { padding-bottom: 12px; }
@media (max-width: 820px) {
  :root[data-theme-style="playful"] .composer {
    padding-bottom: calc(17px + env(safe-area-inset-bottom, 0px));
  }
}
:root[data-theme-style="playful"] .input-wrap {
  border-radius: 20px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 14%, transparent);
  transition: box-shadow .18s ease;
}
:root[data-theme-style="playful"] .input-wrap:focus-within {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 60%, transparent),
    0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
:root[data-theme-style="playful"] .send-btn {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  transition: background .16s ease, color .16s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease;
}
:root[data-theme-style="playful"] .send-btn:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  transform: scale(1.08) rotate(-6deg);
}
:root[data-theme-style="playful"] .send-btn.active {
  background: linear-gradient(135deg, #ff5c8a, #8a5cff);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 92, 138, .42);
}
:root[data-theme-style="playful"] .send-btn.active:hover {
  background: linear-gradient(135deg, #ff709b, #9a72ff);
  transform: scale(1.1) rotate(-6deg);
}
:root[data-theme-style="playful"] .send-btn:active { transform: scale(.9); }

:root[data-theme-style="playful"] .reply-bar,
:root[data-theme-style="playful"] .edit-bar {
  border-left-width: 4px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 10%, var(--input-bg));
}

/* ---------- menus, modals, popovers ---------- */

:root[data-theme-style="playful"] .menu-pop,
:root[data-theme-style="playful"] .popover,
:root[data-theme-style="playful"] .attach-pop,
:root[data-theme-style="playful"] .emoji-pop,
:root[data-theme-style="playful"] .sheet {
  border-radius: 18px;
  border-color: color-mix(in srgb, var(--accent) 20%, var(--border));
  box-shadow: 0 18px 40px rgba(90, 40, 110, .22);
  animation: pf-menu-in .24s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
@keyframes pf-menu-in {
  from { opacity: 0; transform: translateY(8px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

:root[data-theme-style="playful"] .menu-item:hover,
:root[data-theme-style="playful"] .drive-nav-item:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

:root[data-theme-style="playful"] .modal-backdrop {
  background: rgba(50, 20, 70, .42);
  backdrop-filter: blur(6px);
}
:root[data-theme-style="playful"] .task-modal,
:root[data-theme-style="playful"] .profile-modal {
  border-radius: 24px;
  border-color: color-mix(in srgb, var(--accent) 20%, var(--border));
  animation: pf-modal-in .36s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
@keyframes pf-modal-in {
  0% { opacity: 0; transform: translateY(18px) scale(.92); }
  65% { opacity: 1; transform: translateY(-3px) scale(1.012); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
:root[data-theme-style="playful"] .task-modal header span,
:root[data-theme-style="playful"] .profile-modal header span {
  color: var(--accent);
}

:root[data-theme-style="playful"] .toast {
  border-radius: 999px;
  font-weight: 600;
  background: linear-gradient(135deg, #ff5c8a, #8a5cff);
  color: #fff;
  box-shadow: 0 14px 32px rgba(138, 92, 255, .38);
}
:root[data-theme-style="playful"] .toast.show { animation: pf-toast-in .45s cubic-bezier(.34, 1.56, .64, 1) backwards; }
@keyframes pf-toast-in {
  0% { opacity: 0; transform: translate(-50%, 22px) scale(.85); }
  60% { opacity: 1; transform: translate(-50%, -4px) scale(1.03); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ---------- buttons, forms, cards ---------- */

:root[data-theme-style="playful"] .settings-primary,
:root[data-theme-style="playful"] .settings-secondary,
:root[data-theme-style="playful"] .drive-btn,
:root[data-theme-style="playful"] .task-modal footer button,
:root[data-theme-style="playful"] .profile-modal footer button,
:root[data-theme-style="playful"] .auth-submit {
  border-radius: 999px;
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), background .15s ease, color .15s ease, border-color .15s ease, box-shadow .18s ease;
}
:root[data-theme-style="playful"] .settings-primary:hover,
:root[data-theme-style="playful"] .drive-btn:hover,
:root[data-theme-style="playful"] .auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 26%, transparent);
}
:root[data-theme-style="playful"] .settings-primary:active,
:root[data-theme-style="playful"] .settings-secondary:active,
:root[data-theme-style="playful"] .drive-btn:active,
:root[data-theme-style="playful"] .task-modal footer button:active,
:root[data-theme-style="playful"] .profile-modal footer button:active,
:root[data-theme-style="playful"] .auth-submit:active {
  transform: translateY(0) scale(.96);
}
:root[data-theme-style="playful"] .settings-primary {
  background: linear-gradient(135deg, #ff5c8a, #8a5cff);
  color: #fff;
}
:root[data-theme-style="playful"] .settings-primary:hover {
  background: linear-gradient(135deg, #ff709b, #9a72ff);
  color: #fff;
}
:root[data-theme-style="playful"] .settings-secondary {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
}
:root[data-theme-style="playful"] .task-modal footer .primary,
:root[data-theme-style="playful"] .profile-modal footer .primary {
  background: linear-gradient(135deg, #ff5c8a, #8a5cff);
  color: #fff;
}

:root[data-theme-style="playful"] .task-modal .field input,
:root[data-theme-style="playful"] .task-modal .field select,
:root[data-theme-style="playful"] .settings-field input,
:root[data-theme-style="playful"] .settings-field select {
  border-radius: 14px;
}

:root[data-theme-style="playful"] .task-card {
  border-radius: 18px;
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease;
}
:root[data-theme-style="playful"] .task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 16%, transparent);
}

:root[data-theme-style="playful"] .activity-chip {
  border-radius: 999px;
  padding-left: 14px;
  padding-right: 14px;
  background: color-mix(in srgb, var(--accent) 8%, var(--chip));
  font-weight: 600;
}

:root[data-theme-style="playful"] .project-rail-row {
  border-radius: 14px;
  transition: background .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .project-rail-row:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  transform: translateX(3px);
}
:root[data-theme-style="playful"] .project-rail-row.active {
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--accent) 17%, var(--panel)),
    color-mix(in srgb, #8a5cff 13%, var(--panel)));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 16%, transparent);
}
:root[data-theme-style="playful"] .project-view .pd-fact,
:root[data-theme-style="playful"] .project-view .pd-matrix-card,
:root[data-theme-style="playful"] .settings-dept-row,
:root[data-theme-style="playful"] .settings-invite-card,
:root[data-theme-style="playful"] .settings-dept-manager {
  border-radius: 18px;
}

/* Settings rows become soft "bubble" cards with real breathing room, so the
   hover tint never crowds the label or the control. */
:root[data-theme-style="playful"] .settings-row,
:root[data-theme-style="playful"] .settings-toggle-row {
  padding: 13px 16px;
  margin-top: 8px;
  border: 0;
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 9%, var(--border));
  transition: background .16s ease, box-shadow .18s ease, transform .22s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .settings-row:first-of-type,
:root[data-theme-style="playful"] .settings-toggle-row:first-of-type {
  padding-top: 13px;
  border-top: 0;
}
:root[data-theme-style="playful"] .settings-row:hover,
:root[data-theme-style="playful"] .settings-toggle-row:hover {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 10%, var(--panel)),
    color-mix(in srgb, #8a5cff 9%, var(--panel)));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 15%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
  transform: translateY(-1px);
}
:root[data-theme-style="playful"] .settings-card-head h3 {
  display: inline-block;
  position: relative;
}
:root[data-theme-style="playful"] .settings-card-head h3::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: -4px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff5c8a, #8a5cff);
  opacity: .7;
  transform: scaleX(.55);
  transform-origin: left center;
  transition: transform .28s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .settings-card-head:hover h3::after { transform: scaleX(1); }

:root[data-theme-style="playful"] .settings-field input,
:root[data-theme-style="playful"] .settings-inline-form input,
:root[data-theme-style="playful"] .settings-toolbar select,
:root[data-theme-style="playful"] .settings-tone select {
  border-radius: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
:root[data-theme-style="playful"] .settings-field input:focus,
:root[data-theme-style="playful"] .settings-inline-form input:focus,
:root[data-theme-style="playful"] .settings-toolbar select:focus,
:root[data-theme-style="playful"] .settings-tone select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
:root[data-theme-style="playful"] .settings-theme-select {
  border-radius: 999px;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
}

:root[data-theme-style="playful"] .settings-switch {
  transition: background .2s ease;
}
:root[data-theme-style="playful"] .settings-switch span {
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
  box-shadow: 0 2px 6px rgba(90, 40, 110, .22);
}
:root[data-theme-style="playful"] .settings-switch.on {
  background: linear-gradient(135deg, #ff5c8a, #8a5cff);
}
:root[data-theme-style="playful"] .settings-check input {
  width: 16px;
  height: 16px;
  border-radius: 5px;
}

:root[data-theme-style="playful"] .settings-member,
:root[data-theme-style="playful"] .settings-person,
:root[data-theme-style="playful"] .settings-project {
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: 14px;
  transition: background .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .settings-member:hover,
:root[data-theme-style="playful"] .settings-person:hover,
:root[data-theme-style="playful"] .settings-project:hover {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  transform: translateX(3px);
}
:root[data-theme-style="playful"] .settings-icon-btn {
  border-radius: 999px;
  transition: background .15s ease, color .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .settings-icon-btn:hover { transform: scale(1.12) rotate(-6deg); }

:root[data-theme-style="playful"] .settings-dept-row,
:root[data-theme-style="playful"] .settings-invite-card,
:root[data-theme-style="playful"] .settings-dept-manager {
  border-radius: 18px;
  border-color: color-mix(in srgb, var(--accent) 16%, var(--border));
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease, border-color .15s ease;
}
:root[data-theme-style="playful"] .settings-dept-row:hover,
:root[data-theme-style="playful"] .settings-invite-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 16%, transparent);
}
:root[data-theme-style="playful"] .settings-chip {
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), background .15s ease;
}
:root[data-theme-style="playful"] .settings-chip:hover {
  transform: translateY(-1px) rotate(-1.5deg);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-2));
}

/* Settings sidebar list */
:root[data-theme-style="playful"] .settings-nav-user {
  border-radius: 16px;
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), border-color .15s ease, box-shadow .18s ease;
}
:root[data-theme-style="playful"] .settings-nav-user:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 16%, transparent);
}
:root[data-theme-style="playful"] .settings-nav-item {
  border-radius: 12px;
  transition: background .15s ease, color .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme-style="playful"] .settings-nav-item:hover {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  transform: translateX(3px);
}
:root[data-theme-style="playful"] .settings-nav-item.active {
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--accent) 18%, var(--panel)),
    color-mix(in srgb, #8a5cff 14%, var(--panel)));
}

/* Section headings and chat titles get a friendlier weight. */
:root[data-theme-style="playful"] .chat-name { font-weight: 600; }
:root[data-theme-style="playful"] .chat-title h2 { font-weight: 700; }

/* A sparkle for the empty state. */
:root[data-theme-style="playful"] .messages-empty::before { content: "✨ "; }

/* Candy gradients drift across primary buttons while hovered. */
:root[data-theme-style="playful"] .settings-primary,
:root[data-theme-style="playful"] .task-modal footer .primary,
:root[data-theme-style="playful"] .profile-modal footer .primary,
:root[data-theme-style="playful"] .auth-submit,
:root[data-theme-style="playful"] .send-btn.active {
  background-size: 170% 170%;
}
:root[data-theme-style="playful"] .settings-primary:hover,
:root[data-theme-style="playful"] .task-modal footer .primary:hover,
:root[data-theme-style="playful"] .profile-modal footer .primary:hover,
:root[data-theme-style="playful"] .auth-submit:hover,
:root[data-theme-style="playful"] .send-btn.active:hover {
  animation: pf-gradient 2.6s ease infinite;
}
@keyframes pf-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@media (max-width: 560px) {
  :root[data-theme-style="playful"] .settings-row,
  :root[data-theme-style="playful"] .settings-toggle-row { padding: 12px; }
  :root[data-theme-style="playful"] .settings-theme-select { min-width: 0; }
}

:root[data-theme-style="playful"] .settings-view,
:root[data-theme-style="playful"] .project-view,
:root[data-theme-style="playful"] .daily-view,
:root[data-theme-style="playful"] .drive-app {
  animation: pf-view-in .32s cubic-bezier(.34, 1.56, .64, 1) backwards;
  background-image:
    radial-gradient(680px 420px at 100% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
}
@keyframes pf-view-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- auth & boot ---------- */

:root[data-theme-style="playful"][data-theme="light"] .auth-screen {
  background:
    radial-gradient(900px 620px at 8% 10%, rgba(255, 92, 138, .22), transparent 58%),
    radial-gradient(900px 640px at 94% 88%, rgba(138, 92, 255, .20), transparent 56%),
    #fff3f9;
}
:root[data-theme-style="playful"][data-theme="dark"] .auth-screen {
  background:
    radial-gradient(900px 620px at 8% 10%, rgba(255, 143, 179, .16), transparent 58%),
    radial-gradient(900px 640px at 94% 88%, rgba(138, 92, 255, .20), transparent 56%),
    #130d1f;
}
:root[data-theme-style="playful"] .auth-aside {
  background:
    radial-gradient(ellipse 80% 55% at 12% 0%, rgba(255, 92, 138, .34), transparent 62%),
    radial-gradient(ellipse 70% 50% at 105% 112%, rgba(138, 92, 255, .28), transparent 60%),
    linear-gradient(150deg, #3a1450 0%, #241033 48%, #451a5c 100%);
}
:root[data-theme-style="playful"] .auth-card,
:root[data-theme-style="playful"] .boot-card {
  border-radius: 24px;
}
:root[data-theme-style="playful"][data-theme="light"] .boot-splash {
  background:
    radial-gradient(700px 480px at 20% 15%, rgba(255, 92, 138, .18), transparent 64%),
    radial-gradient(700px 480px at 85% 90%, rgba(138, 92, 255, .16), transparent 64%),
    #fff6fb;
}
:root[data-theme-style="playful"][data-theme="dark"] .boot-splash { background: #130d1f; }
:root[data-theme-style="playful"] .brand-mark,
:root[data-theme-style="playful"] .boot-splash .brand-mark {
  background: linear-gradient(135deg, #ff5c8a, #8a5cff);
  box-shadow: 0 8px 20px rgba(138, 92, 255, .34);
}

/* Files module follows the theme's rounded, candy language too. */
:root[data-theme-style="playful"] .drive-app { background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
:root[data-theme-style="playful"] .drive-nav-item { border-radius: 12px; }
:root[data-theme-style="playful"] .drive-btn { border-radius: 999px; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  :root[data-theme-style="playful"] .chat-panel:has(> .chat:not([hidden]))::before,
  :root[data-theme-style="playful"] .messages > .msg-row,
  :root[data-theme-style="playful"] .menu-pop,
  :root[data-theme-style="playful"] .popover,
  :root[data-theme-style="playful"] .attach-pop,
  :root[data-theme-style="playful"] .emoji-pop,
  :root[data-theme-style="playful"] .sheet,
  :root[data-theme-style="playful"] .task-modal,
  :root[data-theme-style="playful"] .profile-modal,
  :root[data-theme-style="playful"] .toast.show,
  :root[data-theme-style="playful"] .rail-btn:hover svg,
  :root[data-theme-style="playful"] .rail-btn.active svg,
  :root[data-theme-style="playful"] .settings-view,
  :root[data-theme-style="playful"] .project-view,
  :root[data-theme-style="playful"] .daily-view,
  :root[data-theme-style="playful"] .drive-app,
  :root[data-theme-style="playful"] .settings-primary:hover,
  :root[data-theme-style="playful"] .task-modal footer .primary:hover,
  :root[data-theme-style="playful"] .profile-modal footer .primary:hover,
  :root[data-theme-style="playful"] .auth-submit:hover,
  :root[data-theme-style="playful"] .send-btn.active:hover {
    animation: none !important;
  }
  :root[data-theme-style="playful"] .chat-item:hover,
  :root[data-theme-style="playful"] .chat-item:hover .avatar,
  :root[data-theme-style="playful"] .rail-btn:hover,
  :root[data-theme-style="playful"] .icon-btn:hover,
  :root[data-theme-style="playful"] .send-btn:hover,
  :root[data-theme-style="playful"] #newChatBtn:hover,
  :root[data-theme-style="playful"] .msg-avatar:hover,
  :root[data-theme-style="playful"] .settings-row:hover,
  :root[data-theme-style="playful"] .settings-toggle-row:hover,
  :root[data-theme-style="playful"] .settings-member:hover,
  :root[data-theme-style="playful"] .settings-person:hover,
  :root[data-theme-style="playful"] .settings-project:hover,
  :root[data-theme-style="playful"] .settings-nav-item:hover,
  :root[data-theme-style="playful"] .settings-nav-user:hover,
  :root[data-theme-style="playful"] .settings-dept-row:hover,
  :root[data-theme-style="playful"] .settings-invite-card:hover,
  :root[data-theme-style="playful"] .settings-chip:hover,
  :root[data-theme-style="playful"] .settings-icon-btn:hover,
  :root[data-theme-style="playful"] .project-rail-row:hover {
    transform: none;
  }
}/* PWA install-help modal (shown on iOS, which has no install prompt event). */

/* Install chip shown under the sign-in card until the app is installed. */
.auth-install {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.auth-install::before {
  content: "";
  width: 15px;
  height: 15px;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300a884' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E");
}
.auth-install:hover {
  color: var(--text);
  border-color: var(--accent);
}
.auth-install:active { transform: translateY(1px); }
.auth-install[hidden] { display: none; }

.install-help {
  width: min(420px, 100%);
}

.install-help .install-help-head b {
  font-size: 16px;
  letter-spacing: -0.01em;
}

.install-help .install-help-head .icon-btn {
  flex: 0 0 auto;
  margin-top: -4px;
}

.install-help .install-help-body {
  padding: 0 26px 24px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.install-help .install-help-body p {
  margin: 0 0 12px;
  color: var(--text-muted);
}

.install-help .install-help-body ol {
  margin: 0;
  padding-left: 20px;
}

.install-help .install-help-body ol li {
  margin-bottom: 8px;
}

.install-help .install-help-body b {
  color: var(--text);
}
/* ---------- reports module (printable PDF reports) ---------- */
.reports-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.reports-view[hidden] { display: none; }

/* ---------- header ---------- */
.reports-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.reports-back { display: none; }
.reports-head-copy { flex: 1; min-width: 180px; }
.reports-head-copy h2 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}
.reports-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.reports-project {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
}
.reports-project > span {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.reports-project select {
  height: 32px;
  min-width: 150px;
  max-width: 260px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
.reports-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.reports-primary:hover { background: #06b78f; }
.reports-primary svg { width: 15px; height: 15px; }

/* Daily report filters live above the PDF preview, not in a side rail. */
.reports-filterbar {
  flex: none;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 22px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}
.reports-date-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.reports-date-field input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
.reports-filter-count {
  align-self: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.reports-filterbar .reports-linkbtn { align-self: center; }

/* ---------- body split ---------- */
.reports-body {
  flex: 1;
  min-height: 0;
  display: flex;
}
.reports-panel {
  flex: none;
  width: 340px;
  max-width: 42vw;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--panel-2);
}
.reports-panel-tools {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
}
.reports-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}
.reports-search svg { width: 15px; height: 15px; flex: none; color: var(--text-muted); }
.reports-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
}
.reports-tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.reports-tool-row b { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.reports-tool-actions { display: inline-flex; gap: 4px; }
.reports-linkbtn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 6px;
  cursor: pointer;
}
.reports-linkbtn:hover { background: var(--hover); }
.reports-linkbtn:disabled { opacity: .45; cursor: default; background: transparent; }
.reports-date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reports-date-grid label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.reports-date-grid input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
.reports-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px;
}
.reports-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.reports-row:hover { background: var(--hover); }
.reports-row input { margin: 2px 0 0; flex: none; }
.reports-row-copy { flex: 1; min-width: 0; }
.reports-row-copy b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reports-row-copy small {
  display: block;
  color: var(--text-muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reports-row-static { cursor: default; }
.reports-row-static:hover { background: transparent; }
.reports-row-date {
  flex: none;
  width: 34px;
  text-align: center;
  padding-top: 1px;
}
.reports-row-date b { display: block; font-size: 15px; line-height: 1.1; }
.reports-row-date small { display: block; color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.reports-status {
  flex: none;
  align-self: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.reports-status.open { color: #b7791f; background: rgba(183, 121, 31, .1); }
.reports-status.answered { color: #1d6fa5; background: rgba(29, 111, 165, .1); }
.reports-status.closed { color: #0f7a5e; background: rgba(15, 122, 94, .1); }
.reports-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ---------- preview ---------- */
.reports-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  background: #eef1f2;
}
.reports-preview iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #eef1f2;
}

/* ---------- no-report empty state ---------- */
.reports-empty-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}
.reports-empty-view h2 { margin: 4px 0 0; font-size: 18px; color: var(--text); }
.reports-empty-view p { margin: 0; max-width: 360px; }
.reports-empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--active);
  color: var(--accent);
}
.reports-empty-icon svg { width: 26px; height: 26px; }

/* ---------- chat-rail report type list ---------- */
.reports-rail { padding: 6px 2px; }
.reports-rail-head {
  margin: 4px 8px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.report-type-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.report-type-row:hover { background: var(--hover); }
.report-type-row.active { background: var(--active); }
.report-type-ico {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--accent);
}
.report-type-row.active .report-type-ico { background: var(--panel); }
.report-type-ico svg { width: 18px; height: 18px; }
.report-type-copy { flex: 1; min-width: 0; }
.report-type-copy b { display: block; font-size: 13.5px; font-weight: 600; }
.report-type-count {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--hover);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ---------- phones ---------- */
@media (max-width: 820px) {
  .reports-back { display: inline-flex; }
  .reports-head { padding: 12px 14px; }
  .reports-filterbar { padding: 10px 14px; }
  .reports-head-copy { min-width: 100%; order: 2; }
  .reports-body { flex-direction: column; }
  .reports-primary span { display: none; }
  .reports-primary { padding: 0 12px; }
}
/* ============================================================
   Plugins — left-rail catalogue of optional tools
   ============================================================ */
.plugins-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.plugins-view[hidden] { display: none; }

/* ---------- sidebar rail ---------- */
.plugins-rail { padding: 6px 8px 12px; }
.plugins-rail-head {
  margin: 6px 10px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.plugin-rail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.plugin-rail-row:hover { background: var(--hover); }
.plugin-new-btn {
  display: block;
  width: calc(100% - 20px);
  margin: 0 10px 8px;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.plugin-new-btn:hover { background: var(--accent); color: #fff; }
.plugin-rail-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.plugin-rail-icon svg { width: 17px; height: 17px; }
.plugin-rail-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.plugin-rail-copy b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plugin-rail-copy small { font-size: 11.5px; color: var(--text-muted); }
.plugin-rail-go { flex: none; display: inline-flex; color: var(--text-muted); opacity: .6; }
.plugin-rail-go svg { width: 14px; height: 14px; }
.plugin-rail-row:hover .plugin-rail-go { color: var(--accent); opacity: 1; }

/* ---------- gallery ---------- */
.plugins-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 26px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}
.plugins-head-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.plugins-head-icon svg { width: 21px; height: 21px; }
.plugins-head-copy { min-width: 0; }
.plugins-head h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.plugins-head p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }

.plugins-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px;
}
.plugins-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  text-align: center;
}
.plugins-home-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.plugins-home-icon svg { width: 26px; height: 26px; }
.plugins-home h2 { margin: 16px 0 5px; font-size: 17px; font-weight: 600; }
.plugins-home p { margin: 0; font-size: 13px; color: var(--text-muted); }

/* ---------- daily log digest builder ---------- */
.plugins-back {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
}
.plugins-back:hover { color: var(--accent); border-color: var(--accent); }
.plugins-back svg { width: 16px; height: 16px; }

/* Back links from a plugin workspace to the Plugins area. */
.plugin-back-rail,
.plugin-back-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.plugin-back-rail:hover { background: var(--hover); color: var(--text); }
.plugin-back-rail svg,
.plugin-back-detail svg { width: 16px; height: 16px; flex: none; }
.plugin-back-detail {
  width: auto;
  margin: 0 0 12px;
  padding: 5px 9px;
  border: 1px solid var(--border);
}
.plugin-back-detail:hover { border-color: var(--accent); color: var(--accent); }

.digest-filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px 14px;
  max-width: 900px;
  margin-bottom: 22px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}
.digest-field-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.digest-field-label select,
.digest-field-label input {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.digest-build,
.digest-action {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.digest-build,
.digest-action.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.digest-action { margin-right: 8px; }

.digest-sheet {
  max-width: 900px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}
.digest-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.digest-sheet-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.2px; }
.digest-sheet-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.digest-sheet-date { font-size: 12px; color: var(--text-muted); }
.digest-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 8px; font-size: 12px; color: var(--text-muted); }
.digest-stats b { color: var(--text); font-weight: 600; }
.digest-group { margin-top: 22px; }
.digest-group h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.digest-day { margin-bottom: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.digest-day header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 12px; color: var(--text-muted); }
.digest-day header time { font-weight: 600; color: var(--text); }
.digest-field { margin: 5px 0; font-size: 12.5px; }
.digest-field span { display: block; font-weight: 600; color: var(--text); }
.digest-field p { margin: 2px 0 0; color: var(--text-muted); white-space: pre-wrap; line-height: 1.5; }
.digest-empty { margin: 0; padding: 22px; text-align: center; font-size: 13px; color: var(--text-muted); }
.digest-sheet-foot { margin-top: 24px; font-size: 11px; color: var(--text-muted); }
.digest-actions { max-width: 900px; margin-top: 14px; }

@media (max-width: 820px) {
  .plugins-head { padding: 14px 16px; }
  .plugins-body { padding: 18px 16px 30px; }
  .digest-filters { padding: 12px; }
  .digest-field-label { min-width: 120px; flex: 1; }
  .digest-sheet { padding: 16px; }
}
/* Self-hosted webfonts (Google Fonts, OFL/Apache) for the handwriting and
   playful choices in Settings → Appearance. Files live in /fonts. */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/caveat-latin-ext-32f76171.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/caveat-latin-706a1c41.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/caveat-latin-ext-32f76171.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/caveat-latin-706a1c41.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Indie Flower';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/indie-flower-latin-ext-28dd8245.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Indie Flower';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/indie-flower-latin-0a3456f4.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Patrick Hand';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/patrick-hand-latin-ext-cb9048d4.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Patrick Hand';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/patrick-hand-latin-81044e49.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/fredoka-latin-ext-18bbd1b5.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/fredoka-latin-a4a694ae.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/fredoka-latin-ext-18bbd1b5.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/fredoka-latin-a4a694ae.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Comic Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/comic-neue-latin-ae7e8315.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Comic Neue';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/comic-neue-latin-5483846c.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* ============================================================
   WhatsApp theme motion — opt-in via Settings → Appearance.
   The default WhatsApp theme is deliberately still; turning the
   Animations toggle on layers transitions and enter animations on
   hovers, chat rows, message bubbles, the composer, the rail and
   the RFI/submittal/change-order flows. Everything here is inert
   until <html data-animations="on">, and honours
   prefers-reduced-motion.
   ============================================================ */

:root[data-theme-style="whatsapp"][data-animations="on"] {
  --wa-ease: cubic-bezier(.22, .9, .28, 1);
  --wa-spring: cubic-bezier(.34, 1.42, .5, 1);
}

/* ---------- shared hover/transition vocabulary ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .icon-btn {
  transition: background .15s ease, color .15s ease, transform .18s var(--wa-ease);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .icon-btn:hover { transform: scale(1.08); }
:root[data-theme-style="whatsapp"][data-animations="on"] .icon-btn:active { transform: scale(.9); }

:root[data-theme-style="whatsapp"][data-animations="on"] #newChatBtn {
  transition: transform .2s var(--wa-spring), box-shadow .18s ease, background .16s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] #newChatBtn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(0, 168, 132, .34);
}
:root[data-theme-style="whatsapp"][data-animations="on"] #newChatBtn:active { transform: scale(.93); }

/* ---------- rail ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .rail-btn {
  transition: background .15s ease, color .15s ease, transform .2s var(--wa-spring), box-shadow .18s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .rail-btn svg {
  transition: transform .2s var(--wa-spring);
}
:root[data-theme-style="whatsapp"][data-animations="on"]:not(.rail-expanded) .rail-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px color-mix(in srgb, var(--mod) 22%, transparent);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .rail-btn:hover svg { transform: scale(1.12); }
:root[data-theme-style="whatsapp"][data-animations="on"] .rail-btn:active { transform: scale(.92); }
:root[data-theme-style="whatsapp"][data-animations="on"] .rail-btn.active svg {
  animation: wa-badge-pop .38s var(--wa-spring);
}

@keyframes wa-badge-pop {
  0% { transform: scale(.82); }
  55% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

/* ---------- chat list ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .chat-item {
  transition: background .15s ease, transform .18s var(--wa-ease);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .chat-item:hover { transform: translateX(2px); }
:root[data-theme-style="whatsapp"][data-animations="on"] .chat-item:active { transform: scale(.99); }
:root[data-theme-style="whatsapp"][data-animations="on"] .chat-item .avatar {
  transition: transform .22s var(--wa-spring);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .chat-item:hover .avatar { transform: scale(1.05); }

:root[data-theme-style="whatsapp"][data-animations="on"] .project-rail-row {
  transition: background .15s ease, transform .18s var(--wa-ease);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .project-rail-row:hover { transform: translateX(2px); }

:root[data-theme-style="whatsapp"][data-animations="on"] .search-box {
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .search-box:focus-within {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .filter {
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .16s var(--wa-ease);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .filter:hover { transform: translateY(-1px); }
:root[data-theme-style="whatsapp"][data-animations="on"] .filter:active { transform: scale(.96); }

/* ---------- message bubbles ---------- */

/* A freshly sent or received bubble slides in from its own side. The class is
   added by renderMessages() only when the newest message actually changed. */
:root[data-theme-style="whatsapp"][data-animations="on"] .msg-row.wa-enter.out {
  animation: wa-bubble-out .32s var(--wa-ease) backwards;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .msg-row.wa-enter.in {
  animation: wa-bubble-in .32s var(--wa-ease) backwards;
}
@keyframes wa-bubble-out {
  from { opacity: 0; transform: translate3d(16px, 10px, 0) scale(.96); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes wa-bubble-in {
  from { opacity: 0; transform: translate3d(-16px, 10px, 0) scale(.96); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

:root[data-theme-style="whatsapp"][data-animations="on"] .bubble {
  transition: box-shadow .18s ease, background .18s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .msg-row:hover .bubble {
  box-shadow: 0 3px 10px color-mix(in srgb, var(--text) 12%, transparent);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .msg-avatar {
  transition: transform .2s var(--wa-spring);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .msg-avatar:hover { transform: scale(1.12); }

:root[data-theme-style="whatsapp"][data-animations="on"] .msg-hover-actions {
  transition: opacity .16s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .msg-act {
  transition: background .14s ease, color .14s ease, transform .16s var(--wa-spring);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .msg-act:hover { transform: scale(1.12); }
:root[data-theme-style="whatsapp"][data-animations="on"] .msg-act:active { transform: scale(.9); }

:root[data-theme-style="whatsapp"][data-animations="on"] .reaction-pill {
  transition: transform .18s var(--wa-spring), background .15s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .reaction-pill:hover {
  transform: translateY(-2px) scale(1.08);
}

:root[data-theme-style="whatsapp"][data-animations="on"] .typing-row { animation: wa-fade-in .26s ease both; }
@keyframes wa-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

:root[data-theme-style="whatsapp"][data-animations="on"] .load-earlier {
  transition: transform .16s var(--wa-ease), background .15s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .load-earlier:hover { transform: translateY(-1px); }

/* ---------- composer ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .input-wrap {
  transition: box-shadow .18s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .input-wrap:focus-within {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .send-btn {
  transition: background .16s ease, color .16s ease, transform .2s var(--wa-spring), box-shadow .2s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .send-btn:hover { transform: scale(1.07); }
:root[data-theme-style="whatsapp"][data-animations="on"] .send-btn.active { box-shadow: 0 5px 14px rgba(0, 168, 132, .34); }
:root[data-theme-style="whatsapp"][data-animations="on"] .send-btn.active:hover { transform: scale(1.1); }
:root[data-theme-style="whatsapp"][data-animations="on"] .send-btn:active { transform: scale(.9); }

/* ---------- menus, popovers, modals ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .menu-pop,
:root[data-theme-style="whatsapp"][data-animations="on"] .popover,
:root[data-theme-style="whatsapp"][data-animations="on"] .attach-pop,
:root[data-theme-style="whatsapp"][data-animations="on"] .emoji-pop,
:root[data-theme-style="whatsapp"][data-animations="on"] .context-menu,
:root[data-theme-style="whatsapp"][data-animations="on"] .sheet {
  animation: wa-menu-in .2s var(--wa-spring) backwards;
}
@keyframes wa-menu-in {
  from { opacity: 0; transform: translateY(7px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

:root[data-theme-style="whatsapp"][data-animations="on"] .menu-item,
:root[data-theme-style="whatsapp"][data-animations="on"] .drive-nav-item {
  transition: background .14s ease, transform .14s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .menu-item:hover,
:root[data-theme-style="whatsapp"][data-animations="on"] .drive-nav-item:hover { transform: translateX(2px); }

:root[data-theme-style="whatsapp"][data-animations="on"] .modal-backdrop {
  animation: wa-fade-in .2s ease both;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .task-modal,
:root[data-theme-style="whatsapp"][data-animations="on"] .profile-modal,
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-modal,
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-confirm-modal,
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-distribute-modal {
  animation: wa-modal-in .3s var(--wa-spring) backwards;
}
@keyframes wa-modal-in {
  0% { opacity: 0; transform: translateY(16px) scale(.95); }
  65% { opacity: 1; transform: translateY(-2px) scale(1.006); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

:root[data-theme-style="whatsapp"][data-animations="on"] .toast.show {
  animation: wa-toast-in .4s var(--wa-spring) backwards;
}
@keyframes wa-toast-in {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(.88); }
  60% { opacity: 1; transform: translate(-50%, -3px) scale(1.02); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ---------- views, cards, settings ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .settings-view,
:root[data-theme-style="whatsapp"][data-animations="on"] .project-view,
:root[data-theme-style="whatsapp"][data-animations="on"] .daily-view,
:root[data-theme-style="whatsapp"][data-animations="on"] .drive-app {
  animation: wa-view-in .28s var(--wa-ease) backwards;
}
@keyframes wa-view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

:root[data-theme-style="whatsapp"][data-animations="on"] .task-card {
  transition: transform .18s var(--wa-ease), box-shadow .18s ease, border-color .15s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--text) 12%, transparent);
}

:root[data-theme-style="whatsapp"][data-animations="on"] .settings-primary,
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-secondary,
:root[data-theme-style="whatsapp"][data-animations="on"] .drive-btn,
:root[data-theme-style="whatsapp"][data-animations="on"] .task-modal footer button,
:root[data-theme-style="whatsapp"][data-animations="on"] .profile-modal footer button,
:root[data-theme-style="whatsapp"][data-animations="on"] .auth-submit {
  transition: transform .18s var(--wa-spring), background .15s ease, color .15s ease, border-color .15s ease, box-shadow .18s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-primary:hover,
:root[data-theme-style="whatsapp"][data-animations="on"] .drive-btn:hover,
:root[data-theme-style="whatsapp"][data-animations="on"] .auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 26%, transparent);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-primary:active,
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-secondary:active,
:root[data-theme-style="whatsapp"][data-animations="on"] .drive-btn:active,
:root[data-theme-style="whatsapp"][data-animations="on"] .auth-submit:active {
  transform: scale(.97);
}

:root[data-theme-style="whatsapp"][data-animations="on"] .settings-switch {
  transition: background .2s ease;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-switch span {
  transition: transform .26s var(--wa-spring);
}

:root[data-theme-style="whatsapp"][data-animations="on"] .settings-nav-item,
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-member,
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-person,
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-row {
  transition: background .15s ease, transform .16s var(--wa-ease);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-nav-item:hover,
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-member:hover,
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-person:hover { transform: translateX(2px); }

:root[data-theme-style="whatsapp"][data-animations="on"] .settings-icon-btn {
  transition: background .15s ease, color .15s ease, transform .18s var(--wa-spring);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .settings-icon-btn:hover { transform: scale(1.1); }

/* ---------- RFI / submittal / change-order sequences ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node {
  animation: wa-slide-in .3s var(--wa-ease) both;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node:nth-child(1) { animation-delay: .02s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node:nth-child(2) { animation-delay: .07s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node:nth-child(3) { animation-delay: .12s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node:nth-child(4) { animation-delay: .17s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node:nth-child(5) { animation-delay: .22s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node:nth-child(6) { animation-delay: .27s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node:nth-child(7) { animation-delay: .32s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node:nth-child(n+8) { animation-delay: .36s; }
@keyframes wa-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Pulse the circular avatar, not the rectangular marker column, so the
   highlight follows the avatar's round shape. */
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-timeline-node.current .rfi-timeline-marker .mini-avatar {
  animation: wa-pulse 2.2s ease-in-out infinite;
}
@keyframes wa-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--panel), 0 0 0 5px var(--accent); }
  50% { box-shadow: 0 0 0 2px var(--panel), 0 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent); }
}

:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-assignee-row {
  animation: wa-slide-in .28s var(--wa-ease) both;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-assignee-row:nth-child(1) { animation-delay: .02s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-assignee-row:nth-child(2) { animation-delay: .06s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-assignee-row:nth-child(3) { animation-delay: .1s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-assignee-row:nth-child(4) { animation-delay: .14s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-assignee-row:nth-child(5) { animation-delay: .18s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-assignee-row:nth-child(n+6) { animation-delay: .22s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-flow-node.filled {
  animation: wa-badge-pop .34s var(--wa-spring);
}

:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-btn,
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-export-btn {
  transition: background .15s ease, color .15s ease, transform .16s var(--wa-spring);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-btn:hover,
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-export-btn:hover { transform: translateY(-1px); }
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-btn:active,
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-export-btn:active { transform: scale(.96); }

:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-distribute-option {
  transition: border-color .15s ease, transform .16s var(--wa-ease);
}
:root[data-theme-style="whatsapp"][data-animations="on"] .rfi-distribute-option:hover { transform: translateY(-1px); }

/* ---------- unread badge pop ---------- */

/* chatItemHTML() adds the class only when a chat's unread count grew, so
   opening a chat or repainting the list never replays it. */
:root[data-theme-style="whatsapp"][data-animations="on"] .badge.wa-pop {
  animation: wa-badge-pop .42s var(--wa-spring) both;
}

/* ---------- scroll-to-latest pill ---------- */

/* Toggling [hidden] restarts the animation, so the pill pops in each time it
   reappears after the reader scrolls away from the live tail. */
:root[data-theme-style="whatsapp"][data-animations="on"] .jump-latest {
  animation: wa-pill-in .3s var(--wa-spring) both;
}
@keyframes wa-pill-in {
  from { opacity: 0; transform: translateY(10px) scale(.88); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- reply / edit bars ---------- */

/* These sit in the composer and are shown by clearing [hidden]; the display
   change restarts the animation each time reply or edit mode opens. */
:root[data-theme-style="whatsapp"][data-animations="on"] .reply-bar,
:root[data-theme-style="whatsapp"][data-animations="on"] .edit-bar {
  animation: wa-bar-in .26s var(--wa-ease) both;
}
@keyframes wa-bar-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- upload ring ---------- */

/* Smoothly fill the conic progress by transitioning the registered --p custom
   property, and pop the ring in the first time it appears. */
@property --p {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .upload-ring {
  transition: --p .25s linear;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .upload-ring:not(.sending) {
  animation: wa-ring-in .34s var(--wa-spring) both;
}
@keyframes wa-ring-in {
  0% { opacity: 0; transform: scale(.7); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- drag & drop overlay ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .drop-overlay.show .drop-overlay-card {
  animation: wa-drop-in .34s var(--wa-spring) both;
}
@keyframes wa-drop-in {
  from { opacity: 0; transform: translateY(12px) scale(.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- conversation switch ---------- */

/* selectChat() adds the class for one frame when the active chat changes. */
:root[data-theme-style="whatsapp"][data-animations="on"] .messages.wa-switch {
  animation: wa-switch .3s var(--wa-ease) both;
}
@keyframes wa-switch {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- voice recording waveform ---------- */

/* The bars already track the mic level via height; this adds an ambient
   bounce so the wave stays alive between level updates. */
:root[data-theme-style="whatsapp"][data-animations="on"] .rec-wave i {
  animation: wa-wave 1.05s ease-in-out infinite;
  transform-origin: center;
}
:root[data-theme-style="whatsapp"][data-animations="on"] .rec-wave i:nth-child(2n) { animation-delay: .12s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rec-wave i:nth-child(3n) { animation-delay: .24s; }
:root[data-theme-style="whatsapp"][data-animations="on"] .rec-wave i:nth-child(4n) { animation-delay: .36s; }
@keyframes wa-wave {
  0%, 100% { transform: scaleY(.6); opacity: .7; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ---------- list rows (daily / reports / invoices) ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] :is(.daily-item, .daily-tl-row, .reports-row, .invoice-detail-row, .invoice-trail-item) {
  animation: wa-slide-in .3s var(--wa-ease) both;
}
:root[data-theme-style="whatsapp"][data-animations="on"] :is(.daily-item, .daily-tl-row, .reports-row, .invoice-detail-row, .invoice-trail-item):nth-child(1) { animation-delay: .02s; }
:root[data-theme-style="whatsapp"][data-animations="on"] :is(.daily-item, .daily-tl-row, .reports-row, .invoice-detail-row, .invoice-trail-item):nth-child(2) { animation-delay: .06s; }
:root[data-theme-style="whatsapp"][data-animations="on"] :is(.daily-item, .daily-tl-row, .reports-row, .invoice-detail-row, .invoice-trail-item):nth-child(3) { animation-delay: .1s; }
:root[data-theme-style="whatsapp"][data-animations="on"] :is(.daily-item, .daily-tl-row, .reports-row, .invoice-detail-row, .invoice-trail-item):nth-child(4) { animation-delay: .14s; }
:root[data-theme-style="whatsapp"][data-animations="on"] :is(.daily-item, .daily-tl-row, .reports-row, .invoice-detail-row, .invoice-trail-item):nth-child(5) { animation-delay: .18s; }
:root[data-theme-style="whatsapp"][data-animations="on"] :is(.daily-item, .daily-tl-row, .reports-row, .invoice-detail-row, .invoice-trail-item):nth-child(6) { animation-delay: .22s; }
:root[data-theme-style="whatsapp"][data-animations="on"] :is(.daily-item, .daily-tl-row, .reports-row, .invoice-detail-row, .invoice-trail-item):nth-child(n+7) { animation-delay: .26s; }

/* ---------- side panel (task / request conversation) ---------- */

:root[data-theme-style="whatsapp"][data-animations="on"] .tasks-panel.task-mode .task-conv-detail {
  animation: wa-panel-in .3s var(--wa-ease) both;
}
@keyframes wa-panel-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- read receipts ---------- */

/* metaHTML() flags a tick that advanced (sent → delivered → read). */
:root[data-theme-style="whatsapp"][data-animations="on"] .tick-btn.wa-tick {
  animation: wa-tick-in .34s var(--wa-spring) both;
}
@keyframes wa-tick-in {
  from { opacity: .35; transform: scale(.7); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- overlay close ---------- */

/* installOverlayCloseMotion() (js/60-live.js) adds .wa-closing just before it
   applies [hidden], so every close path animates out first. */
:root[data-theme-style="whatsapp"][data-animations="on"] .modal-backdrop.wa-closing {
  animation: wa-overlay-out .17s ease forwards;
  pointer-events: none;
}
@keyframes wa-overlay-out { to { opacity: 0; } }
:root[data-theme-style="whatsapp"][data-animations="on"] .sheet-backdrop.wa-closing {
  animation: wa-fade-out .17s ease forwards;
}
@keyframes wa-fade-out { to { opacity: 0; } }
:root[data-theme-style="whatsapp"][data-animations="on"] :is(.menu-pop, .popover, .context-menu, .sheet).wa-closing {
  animation: wa-menu-out .16s var(--wa-ease) forwards;
  pointer-events: none;
}
@keyframes wa-menu-out {
  to { opacity: 0; transform: translateY(6px) scale(.97); }
}

/* ---------- dots honour the animations toggle ---------- */

/* The typing dots and the recording dot animate unconditionally elsewhere; in
   the WhatsApp theme they should still respect the toggle. */
:root[data-theme-style="whatsapp"]:not([data-animations="on"]) .tdot,
:root[data-theme-style="whatsapp"]:not([data-animations="on"]) .rec-dot {
  animation: none;
}

/* ---------- accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  :root[data-theme-style="whatsapp"][data-animations="on"] *,
  :root[data-theme-style="whatsapp"][data-animations="on"] *::before,
  :root[data-theme-style="whatsapp"][data-animations="on"] *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
/* ---------- Invoices (chat-backed, internal-only) ---------- */
#invoiceFilters {
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* Invoice conversation avatar */
.invoice-avatar.open,
.invoice-avatar.answered { background: linear-gradient(135deg, #0b5f8a, #0a4a6b); }
.invoice-avatar.closed { background: linear-gradient(135deg, #6f8290, #46545e); }

/* Overdue flag on a sidebar row */
.chat-flag.overdue { background: rgba(224, 82, 82, .18); color: #e05252; }
:root[data-theme="light"] .chat-flag.overdue { background: #fdeaea; color: #b93a3a; }

/* ---------- create / edit modal ---------- */
.task-modal.invoice-modal { width: min(740px, 100%); }
.invoice-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.invoice-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) {
  .invoice-grid-2,
  .invoice-grid-3 { grid-template-columns: 1fr; }
}

/* Line items: one row by default, plus appends another. */
.invoice-items-section { padding-bottom: 10px; }
.invoice-items-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.invoice-items-hint { font-size: 11.5px; color: var(--text-muted); }
.invoice-items-columns,
.invoice-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 90px 88px 26px 26px;
  gap: 6px;
  align-items: center;
}
.invoice-items-columns {
  margin: 8px 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.invoice-items-columns span:last-child { grid-column: 4; }
.invoice-item-row { margin-bottom: 6px; }
.invoice-item-row input {
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
.invoice-item-row input:focus { outline: none; border-color: var(--accent); }
.invoice-item-qty, .invoice-item-rate { text-align: right; }
.invoice-item-line {
  justify-self: end;
  padding-right: 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.invoice-item-add,
.invoice-item-remove {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.invoice-item-add:hover { border-color: var(--accent); color: var(--accent); }
.invoice-item-remove:hover { border-color: var(--danger, #e05252); color: var(--danger, #e05252); }
@media (max-width: 560px) {
  .invoice-items-columns { display: none; }
  .invoice-item-row {
    grid-template-columns: minmax(0, 1fr) 58px 82px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 9px;
  }
  .invoice-item-line { justify-self: start; }
  .invoice-items-hint { display: none; }
}

.invoice-items-detail { border-top: 1px solid var(--border); }
.invoice-items-detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.invoice-items-detail-row em { font-style: normal; color: var(--text-muted); }
.invoice-items-detail-row b { font-weight: 600; white-space: nowrap; }

.invoice-total-preview {
  margin: 4px 0 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--hover);
}
.invoice-preview-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.invoice-preview-row + .invoice-preview-row { margin-top: 6px; }
.invoice-preview-row b { color: var(--text); font-weight: 600; }
.invoice-preview-row.total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  color: var(--text);
}
.invoice-preview-row.total b { font-size: 17px; font-weight: 700; }

/* ---------- detail panel ---------- */
.invoice-detail { padding: 12px 18px 26px; }
.invoice-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.invoice-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--hover);
  color: var(--text-muted);
}
.invoice-status-pill.draft { background: rgba(134, 150, 160, .2); color: #8696a0; }
.invoice-status-pill.sent { background: rgba(37, 99, 168, .16); color: #3b82c4; }
.invoice-status-pill.paid { background: rgba(0, 168, 132, .16); color: #06b78f; }
.invoice-status-pill.overdue { background: rgba(224, 82, 82, .16); color: #e05252; }
.invoice-status-pill.void { background: rgba(134, 150, 160, .16); color: #8696a0; }
:root[data-theme="light"] .invoice-status-pill.sent { background: #e8f1fb; color: #2563a8; }
:root[data-theme="light"] .invoice-status-pill.paid { background: #e3f6ef; color: #0a7c66; }
:root[data-theme="light"] .invoice-status-pill.overdue { background: #fdeaea; color: #b93a3a; }
.invoice-status-no { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: .02em; }

.invoice-summary {
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0b5f8a, #0a4a6b);
  color: #fff;
}
.invoice-summary-title { font-size: 14px; font-weight: 600; opacity: .94; line-height: 1.35; }
.invoice-summary-total { margin-top: 8px; font-size: 24px; font-weight: 700; letter-spacing: -.3px; }

.invoice-section {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.invoice-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.invoice-detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.invoice-detail-row + .invoice-detail-row { margin-top: 7px; }
.invoice-detail-row b { color: var(--text); font-weight: 600; text-align: right; }
.invoice-detail-row.overdue b { color: #e05252; }
.invoice-detail-row.total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  color: var(--text);
}
.invoice-detail-row.total b { font-size: 16px; font-weight: 700; }
.invoice-notes {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.invoice-trail { display: flex; flex-direction: column; gap: 10px; }
.invoice-trail-item { display: flex; align-items: flex-start; gap: 10px; }
.invoice-trail-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--hover);
  color: var(--accent);
}
.invoice-trail-icon svg { width: 15px; height: 15px; }
.invoice-trail-item b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.4; }
.invoice-trail-item small { display: block; margin-top: 1px; font-size: 11px; color: var(--text-muted); }

.invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.invoice-action {
  flex: 1 1 auto;
  min-width: 96px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.invoice-action:hover { background: var(--hover); }
.invoice-action.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.invoice-action.primary:hover { background: #06b78f; border-color: #06b78f; }

.invoice-foot {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}
/* ============================================================
   "Apple" theme — opt-in via Settings → Appearance.
   Theme id stays `corporate` (localStorage/preview compatibility),
   but the visual language is now iOS / macOS:

     · SF-style type and tighter tracking
     · frosted, translucent navigation bars (vibrancy + blur)
     · continuous rounded corners
     · iMessage bubbles (systemBlue out, systemGray in)
     · Apple system colours (blue accent, green success, red alert)

   The information architecture is unchanged — only palette, shape,
   type and materials get the Apple treatment.
   ============================================================ */

:root[data-theme-style="corporate"][data-theme="light"] {
  /* iOS system colours — light appearance */
  --app-bg: #f2f2f7;                 /* systemGroupedBackground */
  --panel: #ffffff;                  /* systemBackground */
  --panel-2: #f2f2f7;                /* secondarySystemBackground */
  --header: rgba(249, 249, 251, .82); /* translucent nav bar */
  --text: #1c1c1e;                   /* label */
  --text-soft: #3c3c43;              /* secondaryLabel */
  --text-muted: rgba(60, 60, 67, .60);
  --border: rgba(60, 60, 67, .18);   /* separator */
  --accent: #007aff;                 /* systemBlue */
  --accent-hover: #0066d6;
  --accent-soft: rgba(0, 122, 255, .12);
  --bubble-out: #007aff;
  --bubble-in: #e9e9eb;              /* systemGray5 */
  --attach-bg: rgba(120, 120, 128, .12);
  --meta: rgba(60, 60, 67, .60);
  --tick-read: #007aff;
  --wallpaper: #ffffff;
  --wallpaper-pattern: none;
  --hover: rgba(120, 120, 128, .10);
  --active: rgba(0, 122, 255, .12);
  --input-bg: #ffffff;
  --search-bg: rgba(118, 118, 128, .12);
  --scroll: rgba(60, 60, 67, .30);
  --chip: rgba(255, 255, 255, .82);
  --shadow: 0 8px 30px rgba(0, 0, 0, .12);
  --tooltip-bg: #1c1c1e;
  --tooltip-text: #ffffff;
  --tooltip-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  --author-name-1: #007aff;
  --author-name-2: #ff3b30;
  --author-name-3: #34c759;
  --author-name-4: #af52de;
  --author-name-5: #ff9500;
  --author-name-6: #ff2d55;
}

:root[data-theme-style="corporate"][data-theme="dark"] {
  /* iOS system colours — dark appearance */
  --app-bg: #000000;
  --panel: #1c1c1e;                  /* secondarySystemBackground */
  --panel-2: #2c2c2e;                /* tertiarySystemBackground */
  --header: rgba(28, 28, 30, .80);
  --text: #ffffff;
  --text-soft: rgba(235, 235, 245, .82);
  --text-muted: rgba(235, 235, 245, .55);
  --border: rgba(84, 84, 88, .55);
  --accent: #0a84ff;                 /* systemBlue (dark) */
  --accent-hover: #3395ff;
  --accent-soft: rgba(10, 132, 255, .22);
  --bubble-out: #0a84ff;
  --bubble-in: #26262a;
  --attach-bg: rgba(120, 120, 128, .24);
  --meta: rgba(235, 235, 245, .55);
  --tick-read: #0a84ff;
  --wallpaper: #000000;
  --wallpaper-pattern: none;
  --hover: rgba(255, 255, 255, .07);
  --active: rgba(10, 132, 255, .24);
  --input-bg: #1c1c1e;
  --search-bg: rgba(118, 118, 128, .24);
  --scroll: rgba(235, 235, 245, .30);
  --chip: rgba(28, 28, 30, .82);
  --shadow: 0 16px 44px rgba(0, 0, 0, .60);
  --tooltip-bg: #f2f2f7;
  --tooltip-text: #1c1c1e;
  --tooltip-shadow: 0 10px 28px rgba(0, 0, 0, .55);
  --author-name-1: #4aa8ff;
  --author-name-2: #ff6961;
  --author-name-3: #30d158;
  --author-name-4: #bf5af2;
  --author-name-5: #ffd60a;
  --author-name-6: #ff6482;
}

/* ---------- canvas & type ---------- */

:root[data-theme-style="corporate"] body {
  font-family: var(--app-font,
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme-style="corporate"] .app { background: var(--panel); }

/* ---------- frosted navigation bars (vibrancy) ---------- */

:root[data-theme-style="corporate"] .side-header,
:root[data-theme-style="corporate"] .chat-header,
:root[data-theme-style="corporate"] .composer {
  background: var(--header);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
:root[data-theme-style="corporate"] .side-header {
  border-bottom: 1px solid var(--border);
}
:root[data-theme-style="corporate"] .chat-header {
  border-bottom: 1px solid var(--border);
}
:root[data-theme-style="corporate"] .composer {
  border-top: 1px solid var(--border);
}

/* Browsers without backdrop-filter get an opaque bar instead of a wash. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root[data-theme-style="corporate"] .side-header,
  :root[data-theme-style="corporate"] .chat-header,
  :root[data-theme-style="corporate"] .composer {
    background: var(--panel);
  }
}

:root[data-theme-style="corporate"] .sidebar { border-right-color: var(--border); }

/* Apple Messages uses a plain canvas — drop the doodle wallpaper. */
:root[data-theme-style="corporate"] .chat-panel {
  background-color: var(--wallpaper);
  background-image: none;
}

/* Larger, slightly bolder titles, like iOS navigation bars. */
:root[data-theme-style="corporate"] .chat-title h2 { font-size: 17px; font-weight: 600; }
:root[data-theme-style="corporate"] .chat-name { font-weight: 600; letter-spacing: -.2px; }

/* ---------- shape ---------- */

:root[data-theme-style="corporate"] .bubble {
  border-radius: 19px;
  box-shadow: none;
  font-size: 15px;
  line-height: 21px;
}
:root[data-theme-style="corporate"] .bubble.out { border-top-right-radius: 19px; }
:root[data-theme-style="corporate"] .bubble.in { border-top-left-radius: 19px; }
/* Keep the tail corner square so the hook merges into the bubble instead of
   floating away from a rounded corner (the shorthand above, being later, would
   otherwise round it too). */
:root[data-theme-style="corporate"] .bubble.tail.out { border-top-right-radius: 0; }
:root[data-theme-style="corporate"] .bubble.tail.in { border-top-left-radius: 0; }
:root[data-theme-style="corporate"] .input-wrap {
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 8px 14px;
}
:root[data-theme-style="corporate"] .search-box {
  border-radius: 10px;
  height: 38px;
  padding: 0 12px;
}
:root[data-theme-style="corporate"] .chat-item { border-radius: 10px; }
:root[data-theme-style="corporate"] .chat-item.active { background: var(--active); }
:root[data-theme-style="corporate"] .popover,
:root[data-theme-style="corporate"] .menu-pop { border-radius: 14px; }

/* iMessage bubbles: white text and light ticks on the blue outgoing bubble. */
:root[data-theme-style="corporate"] .bubble.out { color: #fff; }
:root[data-theme-style="corporate"] .bubble.out .author { color: rgba(255, 255, 255, .92); }
:root[data-theme-style="corporate"] .bubble.out .meta { color: rgba(255, 255, 255, .72); }
:root[data-theme-style="corporate"] .bubble.out .tick { color: rgba(255, 255, 255, .72); }
:root[data-theme-style="corporate"] .bubble.out .tick.read { color: #fff; }
:root[data-theme-style="corporate"] .bubble.out a { color: #fff; }

/* Inner bits of the blue outgoing bubble need light-on-blue treatment. */
:root[data-theme-style="corporate"] .bubble.out :is(.doc-size, .doc-dl, .dur, .voice-cancel) {
  color: rgba(255, 255, 255, .74);
}
:root[data-theme-style="corporate"] .bubble.out .doc { background: rgba(255, 255, 255, .16); }
:root[data-theme-style="corporate"] .bubble.out .doc-dl:hover { color: #fff; background: rgba(255, 255, 255, .16); }
:root[data-theme-style="corporate"] .bubble.out .play-btn { color: #fff; background: rgba(255, 255, 255, .20); }
:root[data-theme-style="corporate"] .bubble.out .play-btn:hover { background: rgba(255, 255, 255, .30); }
:root[data-theme-style="corporate"] .bubble.out .voice-rate { color: #fff; background: rgba(255, 255, 255, .18); }
:root[data-theme-style="corporate"] .bubble.out .voice-rate:hover { background: rgba(255, 255, 255, .28); }
:root[data-theme-style="corporate"] .bubble.out .voice-ring { color: #fff; }
:root[data-theme-style="corporate"] .bubble.out .mention:not(.me) {
  color: #fff;
  background: rgba(255, 255, 255, .20);
}
:root[data-theme-style="corporate"] .bubble.out :is(.msg-forwarded, .msg-quote-copy span, .deleted-text) {
  color: rgba(255, 255, 255, .78);
}
:root[data-theme-style="corporate"] .bubble.out .msg-quote {
  border-left-color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .16);
}
:root[data-theme-style="corporate"] .bubble.out .msg-quote:hover { background: rgba(255, 255, 255, .24); }
:root[data-theme-style="corporate"] .bubble.out .msg-quote-copy b { color: #fff; }

/* ---------- controls & system tint ---------- */

/* Every primary action takes the system blue; hover deepens it. */
:root[data-theme-style="corporate"] :is(
  .settings-primary,
  .new-task,
  .task-modal footer .primary,
  .profile-form-actions .primary,
  .dept-add .primary,
  .proof-form-actions .primary,
  .detail-actions .primary,
  .task-conv-footer button.primary,
  .daily-primary,
  .push-daily-confirm,
  .rfi-btn.primary,
  .rfi-export-btn,
  .reports-primary,
  .invoice-action.primary,
  .mention.me,
  .send-btn.active,
  .auth-submit
):hover,
:root[data-theme-style="corporate"] #newChatBtn:hover,
:root[data-theme-style="corporate"] .send-btn.active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

/* iOS switch: the on-track is the system green, as on device. */
:root[data-theme-style="corporate"] .settings-switch.on { background: #34c759; }
:root[data-theme-style="corporate"][data-theme="dark"] .settings-switch.on { background: #30d158; }

/* Conversation filters read as an iOS segmented control when selected. */
:root[data-theme-style="corporate"] .filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- brand & avatars ---------- */

/* An app-icon-like blue squircle rather than the old graphite badge. */
:root[data-theme-style="corporate"] .brand-mark,
:root[data-theme-style="corporate"] .auth-logo .brand-mark,
:root[data-theme-style="corporate"] .boot-splash .brand-mark,
:root[data-theme-style="corporate"] .auth-card-brand .brand-mark {
  background: linear-gradient(150deg, #2f95ff 0%, #007aff 52%, #0064d8 100%);
  box-shadow: 0 6px 18px rgba(0, 122, 255, .38);
  color: #fff;
}
:root[data-theme-style="corporate"] .brand-mark { border-radius: 11px; }

:root[data-theme-style="corporate"] .avatar.me,
:root[data-theme-style="corporate"] .profile-head .profile-avatar,
:root[data-theme-style="corporate"] .menu-profile-avatar,
:root[data-theme-style="corporate"] .group-info-avatar {
  background: linear-gradient(150deg, #4aa8ff, #007aff);
}
:root[data-theme-style="corporate"] .online-dot { background: #34c759; }

/* Task/RFI status avatars stay semantic, but in Apple's system green. */
:root[data-theme-style="corporate"] .task-avatar.closed,
:root[data-theme-style="corporate"] .rfi-avatar.open {
  background: linear-gradient(150deg, #5ce27a, #34c759);
}

/* Rail: system-blue selection, matching the rest of the tint language. */
:root[data-theme-style="corporate"] .rail-btn,
:root[data-theme-style="corporate"] .rail-btn[data-rail] { --mod: #007aff; }

/* ---------- auth & boot ---------- */

:root[data-theme-style="corporate"] .auth-screen { background: var(--app-bg); }
/* The sign-in button keeps its lift, but in Apple's system blue. */
:root[data-theme-style="corporate"] .auth-submit {
  background: linear-gradient(150deg, #4aa8ff 0%, #007aff 55%, #0064d8 100%);
  box-shadow: 0 8px 22px rgba(0, 122, 255, .30);
}
:root[data-theme-style="corporate"] .auth-aside {
  background:
    radial-gradient(120% 85% at 0% 0%, rgba(10, 132, 255, .55), transparent 60%),
    radial-gradient(95% 75% at 100% 100%, rgba(175, 82, 222, .42), transparent 62%),
    radial-gradient(80% 60% at 85% 8%, rgba(48, 209, 88, .22), transparent 60%),
    linear-gradient(160deg, #0b1020 0%, #05070d 55%, #0b1226 100%);
}
:root[data-theme-style="corporate"] .auth-aside::after {
  border-color: rgba(255, 255, 255, .12);
  box-shadow: 0 0 0 60px rgba(255, 255, 255, .03), 0 0 0 120px rgba(255, 255, 255, .02);
}
:root[data-theme-style="corporate"] .auth-card,
:root[data-theme-style="corporate"] .boot-card { border-radius: 18px; }
:root[data-theme-style="corporate"] .boot-splash { background: #f2f2f7; }
:root[data-theme-style="corporate"][data-theme="dark"] .boot-splash { background: #000000; }


/* ============================================================
   User chat background — opt-in via Settings → Appearance.
   A photo or animated GIF the user picks is kept in this browser
   and drawn behind every conversation, above the theme's own
   --wallpaper pattern. A light scrim keeps bubbles readable on
   busy images. The URL arrives as an inline --chat-bg-image set on
   :root (see index.html + js/60-live.js); nothing here is active
   until data-chat-bg="on".
   ============================================================ */

:root[data-chat-bg="on"][data-theme-style] .chat-panel {
  background-color: var(--wallpaper);
  background-image:
    linear-gradient(var(--chat-bg-scrim, transparent), var(--chat-bg-scrim, transparent)),
    var(--chat-bg-image, none);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* Dim the chosen image so white incoming bubbles stay legible. */
:root[data-chat-bg="on"][data-theme-style][data-theme="light"] .chat-panel {
  --chat-bg-scrim: rgba(0, 0, 0, .06);
}
:root[data-chat-bg="on"][data-theme-style][data-theme="dark"] .chat-panel {
  --chat-bg-scrim: rgba(0, 0, 0, .34);
}

/* ---------- Settings → Appearance control ---------- */

.settings-chatbg-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.settings-chatbg-preview {
  display: block;
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 10px;
  background: var(--wallpaper);
}
/* External client accounts use the same layout, but with internal-only actions hidden.
   The right-hand detail panel stays available: clients can read RFI/submittal/CO
   records (and their own task details) for projects they belong to. */
#app.external-client [data-new-action="task"],
#app.external-client [data-new-action="group"],
#app.external-client [data-new-action="rfi"],
#app.external-client [data-new-action="submittal"],
#app.external-client [data-new-action="change-order"],
#app.external-client [data-new-action="daily"],
#app.external-client [data-new-action="project"],
#app.external-client [data-new-action="invoice"] { display: none !important; }
/* ---------- welcome-screen snake ---------- */
.empty-state { overflow-y: auto; justify-content: flex-start; }
.empty-inner {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0;
}
.snake-disclosure {
  width: 360px;
  max-width: 100%;
  margin-top: 20px;
  color: var(--text-muted);
}
.snake-disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}
.snake-disclosure > summary::-webkit-details-marker { display: none; }
.snake-disclosure > summary::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid var(--accent);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform .15s ease;
}
.snake-disclosure[open] > summary::before { transform: rotate(90deg); }
.snake-disclosure > summary:hover { color: var(--text); }
.snake-summary-meta { font-size: 11px; opacity: .7; }
.snake-game { width: 100%; margin-top: 14px; }
.snake-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
  margin-bottom: 8px;
}
.snake-score { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.snake-score b { color: var(--accent); font-weight: 700; }
.snake-score i { font-style: normal; opacity: .5; margin: 0 5px; }
.snake-head-actions { display: inline-flex; gap: 12px; }
.snake-text-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}
.snake-text-btn:hover { color: var(--accent); }
.snake-text-btn[hidden], .snake-scores[hidden] { display: none; }
.snake-stage { position: relative; width: 320px; max-width: 100%; margin: 0 auto; aspect-ratio: 1; }
#snakeCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  opacity: .9;
  touch-action: none;
}
.snake-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 16px;
  text-align: center;
  /* Scrim so "Paused" / "Resume" stay readable over the board and snake. */
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-radius: 4px;
}
.snake-overlay[hidden] { display: none; }
.snake-overlay b { font-size: 15px; font-weight: 600; color: var(--text); }
.snake-overlay span { max-width: 220px; font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
.snake-btn {
  border: 0;
  border-radius: 7px;
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  font: 700 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  opacity: .92;
}
.snake-btn:hover { opacity: 1; }
.snake-btn:active { transform: translateY(1px); }
.snake-pad { display: none; }
.snake-scores { margin: 9px 0 0; font-size: 10.5px; color: var(--text-muted); opacity: .8; }
.snake-hint { margin: 6px 0 0; font-size: 10.5px; color: var(--text-muted); opacity: .6; }

@media (hover: none), (pointer: coarse) {
  .snake-pad {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    gap: 4px;
    justify-content: center;
    margin-top: 10px;
  }
  .snake-pad .snake-up { grid-column: 2; }
  .snake-pad button {
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
  }
  .snake-pad button:active { color: var(--accent); }
  .snake-hint { display: none; }
}
/* ============================================================
   AI thread summarizer / task draft
   ============================================================ */
.ai-summary-modal { width: min(620px, 100%); }
.ai-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.ai-modal-head span { font-size: 9.5px; letter-spacing: .1em; font-weight: 700; color: var(--text-muted); }
.ai-modal-body { padding: 16px 20px; max-height: min(65vh, 560px); overflow-y: auto; }
.ai-modal-foot { display: flex; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.ai-modal-foot button { padding: 8px 16px; border-radius: 6px; font-size: 12.5px; }
.ai-modal-foot .primary { background: var(--accent); color: #fff; border: 0; font-weight: 600; }

.ai-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; }
.ai-loading p { margin: 0; font-size: 13.5px; font-weight: 600; }
.ai-loading small { font-size: 11.5px; color: var(--text-muted); }
.ai-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: ai-spin .8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

.ai-error { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 20px; text-align: center; }
.ai-error-icon { color: #e0245e; }
.ai-error-icon svg { width: 32px; height: 32px; }
.ai-error p { margin: 0; font-size: 13px; font-weight: 600; text-transform: capitalize; }
.ai-error small { font-size: 11.5px; color: var(--text-muted); }

.ai-summary-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.ai-badge {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .05em;
}
.ai-summary-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.ai-summary-head small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.ai-block { margin-bottom: 18px; }
.ai-block h3 {
  margin: 0 0 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
}
.ai-overview { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text); }
.ai-block ul { margin: 0; padding-left: 20px; }
.ai-block li { font-size: 12.5px; line-height: 1.5; margin-bottom: 5px; }

.ai-tasks { border-top: 1px solid var(--border); padding-top: 14px; }
.ai-task { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.ai-task-copy { flex: 1; min-width: 0; }
.ai-task-copy b { display: block; font-size: 12.5px; font-weight: 600; }
.ai-task-copy small { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.ai-task-add { flex: none; padding: 6px 10px; font-size: 11.5px; }
.ai-task-add:disabled { opacity: .55; cursor: not-allowed; }
/* ============================================================
   Cobalt2 theme — opt-in via Settings → Appearance.
   Port of the OpenCode Cobalt2 palette to the app's theme vars:

     canvas #193549   alt #122738   panel #1f4662
     text #ffffff     muted #adb7c9
     primary blue #0088ff   accent mint #2affdf
     yellow #ffc600   orange #ff9d00   purple #9a5feb
     green #9eff80    pink #ff628c     red #ff0088

   The app's `--accent` drives primary buttons, so it maps to the
   theme's blue; the mint is used for highlights, ticks and the
   active-chat marker. Both light and dark modes are defined from
   the matching light/dark variants in OpenCode's theme file.
   ============================================================ */

:root[data-theme-style="cobalt2"][data-theme="dark"] {
  --app-bg: #122738;                /* backgroundAlt */
  --panel: #193549;                 /* background */
  --panel-2: #1f4662;               /* backgroundElement */
  --header: #193549;
  --text: #ffffff;                  /* foreground */
  --text-soft: #dbe8f5;
  --text-muted: #adb7c9;            /* foregroundMuted */
  --border: #2d5a7b;                /* markdownHorizontalRule */
  --accent: #0088ff;                /* primary (blue) */
  --accent-hover: #5cb7ff;          /* blueBright */
  --accent-soft: rgba(0, 136, 255, .24);
  --cobalt-mint: #2affdf;
  --cobalt-mint-soft: rgba(42, 255, 223, .16);
  --cobalt-yellow: #ffc600;
  --cobalt-purple: #9a5feb;
  --cobalt-green: #9eff80;
  --cobalt-pink: #ff628c;
  --bubble-out: #1d5e8c;            /* cobalt bubble, white text */
  --bubble-in: #1f4662;
  --attach-bg: rgba(173, 183, 201, .12);
  --meta: rgba(173, 183, 201, .78);
  --tick-read: #2affdf;
  --wallpaper: #193549;
  /* Editor-style dot grid instead of the WhatsApp doodles. */
  --wallpaper-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='1' fill='%232d5a7b' fill-opacity='.6'/%3E%3C/svg%3E");
  --hover: rgba(255, 255, 255, .07);
  --active: #1f4662;
  --input-bg: #122738;
  --search-bg: #122738;
  --scroll: rgba(173, 183, 201, .38);
  --chip: rgba(31, 70, 98, .92);
  --shadow: 0 14px 40px rgba(0, 0, 0, .40);
  --tooltip-bg: #122738;
  --tooltip-text: #ffffff;
  --tooltip-shadow: 0 10px 30px rgba(0, 0, 0, .48);
  --author-name-1: #5cb7ff;         /* blueBright */
  --author-name-2: #ff86a5;         /* pinkBright */
  --author-name-3: #b9ff9f;         /* greenBright */
  --author-name-4: #b88cfd;         /* purpleBright */
  --author-name-5: #ffb454;         /* orangeBright */
  --author-name-6: #7efff5;         /* mintBright */
}

:root[data-theme-style="cobalt2"][data-theme="light"] {
  --app-bg: #e8ecf1;                /* backgroundElement (light) */
  --panel: #ffffff;
  --panel-2: #f5f7fa;               /* backgroundPanel (light) */
  --header: #ffffff;
  --text: #193549;
  --text-soft: #334d62;
  --text-muted: #5c6b7d;
  --border: #d3dae3;
  --accent: #0066cc;                /* primary (light) */
  --accent-hover: #0052a3;
  --accent-soft: rgba(0, 102, 204, .13);
  --cobalt-mint: #00acc1;
  --cobalt-mint-soft: rgba(0, 172, 193, .13);
  --cobalt-yellow: #b57a00;
  --cobalt-purple: #6d3fc4;
  --cobalt-green: #2f7c4f;
  --cobalt-pink: #c2185b;
  --bubble-out: #d6f1f5;
  --bubble-in: #ffffff;
  --attach-bg: rgba(25, 53, 73, .06);
  --meta: rgba(92, 107, 125, .82);
  --tick-read: #00acc1;
  --wallpaper: #e8ecf1;
  --wallpaper-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='1' fill='%2394a9b8' fill-opacity='.65'/%3E%3C/svg%3E");
  --hover: rgba(25, 53, 73, .055);
  --active: #dfeaf3;
  --input-bg: #ffffff;
  --search-bg: #f5f7fa;
  --scroll: rgba(92, 107, 125, .38);
  --chip: rgba(255, 255, 255, .94);
  --shadow: 0 14px 36px rgba(25, 53, 73, .16);
  --tooltip-bg: #193549;
  --tooltip-text: #ffffff;
  --tooltip-shadow: 0 10px 30px rgba(25, 53, 73, .24);
  --author-name-1: #0066cc;
  --author-name-2: #c2185b;
  --author-name-3: #2f7c4f;
  --author-name-4: #6d3fc4;
  --author-name-5: #a15c00;
  --author-name-6: #007f8f;
}

/* ---------- canvas & chrome ---------- */

:root[data-theme-style="cobalt2"] body {
  font-family: var(--app-font, "Inter", "Segoe UI", system-ui, -apple-system, sans-serif);
}
:root[data-theme-style="cobalt2"] ::selection { background: var(--cobalt-mint-soft); }

:root[data-theme-style="cobalt2"] .app { background: var(--panel); }

:root[data-theme-style="cobalt2"] .side-header,
:root[data-theme-style="cobalt2"] .chat-header {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
}

:root[data-theme-style="cobalt2"] .search-box,
:root[data-theme-style="cobalt2"] .input-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* The tinted row is enough to mark the selected conversation — no left stripe. */
:root[data-theme-style="cobalt2"] .chat-item.active { box-shadow: none; }

/* Cobalt2 ships only the dark palette, so keep every light/dark switch out of
   the way (Appearance hides its Mode row in JS as well). */
:root[data-theme-style="cobalt2"] :is([data-action="theme"], #profileThemeBtn) {
  display: none;
}
:root[data-theme-style="cobalt2"] .filter.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

:root[data-theme-style="cobalt2"] .pinned-bar { box-shadow: inset 3px 0 0 var(--cobalt-mint); }
:root[data-theme-style="cobalt2"] .pinned-icon,
:root[data-theme-style="cobalt2"] .pinned-copy b { color: var(--cobalt-mint); }
:root[data-theme-style="cobalt2"] .chat-title p.online { color: var(--cobalt-green); }

/* ---------- messages ---------- */

:root[data-theme-style="cobalt2"] .bubble {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
  font-size: 14px;
  line-height: 20px;
}
:root[data-theme-style="cobalt2"][data-theme="light"] .bubble {
  box-shadow: 0 1px 4px rgba(25, 53, 73, .18);
}

/* The hooks share the bubble fill and overlap its edge by a few pixels, so
   they read as part of the bubble rather than a separate floating triangle. */
:root[data-theme-style="cobalt2"] .bubble.tail.out::after {
  right: -4px;
  width: 7px;
  height: 13px;
}
:root[data-theme-style="cobalt2"] .bubble.tail.in::after {
  left: -4px;
  width: 7px;
  height: 13px;
}

/* On the dark canvas the outgoing bubble is white text on cobalt blue. */
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out { color: #ffffff; }
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out :is(
  .author, .meta, .tick, .msg-forwarded, .msg-quote-copy span, .deleted-text
) { color: rgba(255, 255, 255, .80); }
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out .tick.read {
  color: var(--cobalt-mint);
}
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out a { color: #7efff5; }
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out :is(
  .doc-size, .doc-dl, .dur, .voice-cancel
) { color: rgba(255, 255, 255, .75); }
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out .doc {
  background: rgba(255, 255, 255, .14);
}
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out .play-btn {
  color: #ffffff;
  background: rgba(255, 255, 255, .18);
}
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out .voice-rate {
  color: #ffffff;
  background: rgba(255, 255, 255, .16);
}
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out .mention:not(.me) {
  color: #ffffff;
  background: rgba(255, 255, 255, .18);
}
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out .msg-quote {
  border-left-color: rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .14);
}
:root[data-theme-style="cobalt2"][data-theme="dark"] .bubble.out .msg-quote-copy b { color: #ffffff; }

/* ---------- controls & system tint ---------- */

/* Most primary buttons have a hardcoded green hover; give them Cobalt blue. */
:root[data-theme-style="cobalt2"] :is(
  .settings-primary,
  .new-task,
  .task-modal footer .primary,
  .profile-form-actions .primary,
  .dept-add .primary,
  .proof-form-actions .primary,
  .detail-actions .primary,
  .task-conv-footer button.primary,
  .daily-primary,
  .push-daily-confirm,
  .rfi-btn.primary,
  .rfi-export-btn,
  .reports-primary,
  .invoice-action.primary,
  .mention.me,
  .send-btn.active,
  .auth-submit
):hover,
:root[data-theme-style="cobalt2"] #newChatBtn:hover,
:root[data-theme-style="cobalt2"] .send-btn.active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}

/* ---------- brand & avatars ---------- */

:root[data-theme-style="cobalt2"] :is(
  .brand-mark, .auth-logo .brand-mark, .boot-splash .brand-mark,
  .auth-card-brand .brand-mark
) {
  background: linear-gradient(150deg, #0088ff 0%, #0066cc 52%, #2affdf 145%);
  box-shadow: 0 6px 18px rgba(0, 136, 255, .38);
  color: #ffffff;
}
:root[data-theme-style="cobalt2"] .brand-mark { border-radius: 10px; }

:root[data-theme-style="cobalt2"] :is(
  .avatar.me, .profile-head .profile-avatar,
  .menu-profile-avatar, .group-info-avatar
) {
  background: linear-gradient(150deg, #0088ff, #9a5feb);
}
:root[data-theme-style="cobalt2"] .online-dot { background: var(--cobalt-mint); }

/* Rail: one syntax-blue tint across the modules. */
:root[data-theme-style="cobalt2"] .rail-btn,
:root[data-theme-style="cobalt2"] .rail-btn[data-rail] {
  --mod: var(--cobalt-mint);
}
:root[data-theme-style="cobalt2"][data-theme="light"] .rail-btn,
:root[data-theme-style="cobalt2"][data-theme="light"] .rail-btn[data-rail] {
  --mod: #0066cc;
}

/* ---------- auth & boot ---------- */

:root[data-theme-style="cobalt2"] .auth-screen { background: var(--app-bg); }
:root[data-theme-style="cobalt2"] .auth-submit {
  background: linear-gradient(135deg, #0088ff 0%, #0066cc 55%, #0052a3 100%);
  box-shadow: 0 8px 22px rgba(0, 136, 255, .30);
}
:root[data-theme-style="cobalt2"] .auth-aside {
  color: #eaf6ff;
  background:
    radial-gradient(120% 85% at 0% 0%, rgba(0, 136, 255, .55), transparent 60%),
    radial-gradient(95% 75% at 100% 100%, rgba(154, 95, 235, .36), transparent 62%),
    radial-gradient(80% 60% at 85% 8%, rgba(42, 255, 223, .22), transparent 60%),
    linear-gradient(160deg, #0e2336 0%, #122738 55%, #152e45 100%);
}
:root[data-theme-style="cobalt2"] .auth-aside::before {
  background-image:
    linear-gradient(rgba(92, 183, 255, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 183, 255, .09) 1px, transparent 1px);
  background-size: 36px 36px;
}
:root[data-theme-style="cobalt2"] .auth-aside::after {
  border-color: rgba(42, 255, 223, .28);
  box-shadow: 0 0 0 60px rgba(42, 255, 223, .035), 0 0 0 120px rgba(0, 136, 255, .025);
}
:root[data-theme-style="cobalt2"] .boot-splash { background: #e8ecf1; }
:root[data-theme-style="cobalt2"][data-theme="dark"] .boot-splash { background: #122738; }
:root[data-theme-style="cobalt2"] .boot-progress-bar { background: var(--accent); }
