/* Ray White Overview — design tokens, layout and components. */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, Roboto, "Noto Sans", "Noto Sans Bengali", sans-serif;
  /* Ray White navy. --brand-tint is the lighter navy used on dark backgrounds (sidebar, dark mode). */
  --brand: #162B4E; --brand-hover: #1f3a66; --brand-ink: #ffffff; --brand-tint: #9db8e6;
  --focus-glow: rgba(22, 43, 78, .16); --check: #162B4E;

  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #eff1f4;
  --border: #e5e7eb; --border-strong: #d1d5db;
  --text: #111318; --text-2: #3f4651; --muted: #6b7280; --faint: #9ca3af;
  --ring: #162B4E; --link: #1d4ed8;
  --danger: #dc2626; --danger-soft: #fef2f2;
  --overlay: rgba(17, 19, 24, .48);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;

  --side-bg: #121316; --side-text: #a6abb4; --side-strong: #f4f5f7; --side-hover: rgba(255, 255, 255, .06); --side-border: rgba(255, 255, 255, .07);

  --chat-bg: #f1f2f4; --bubble-in: #ffffff; --bubble-ai: #f0f9f3; --bubble-ai-border: #d5eedd; --bubble-staff: #eef4ff; --bubble-staff-border: #d6e4ff;

  /* badge tones: background / text */
  --gray-bg: #f1f3f5; --gray-fg: #4b5563;
  --green-bg: #e7f7ee; --green-fg: #127a3e;
  --blue-bg: #e8f0fe; --blue-fg: #1d4ed8;
  --indigo-bg: #eef0ff; --indigo-fg: #4338ca;
  --violet-bg: #f3edff; --violet-fg: #6d28d9;
  --amber-bg: #fff4e0; --amber-fg: #b45309;
  --orange-bg: #ffefe5; --orange-fg: #c2410c;
  --teal-bg: #e3f7f5; --teal-fg: #0f766e;
  --cyan-bg: #e2f6fb; --cyan-fg: #0e7490;
  --red-bg: #fdecec; --red-fg: #b91c1c;
  --navy-bg: #e8eef7; --navy-fg: #162B4E;
  color-scheme: light;
}
/* Dark theme: set by /js/core/theme.js from the user's choice (or the system setting) before first paint. */
:root[data-theme="dark"] {
    --bg: #0c0d10; --surface: #15171b; --surface-2: #1a1d22; --surface-3: #22262c;
    --border: #262a31; --border-strong: #353a42;
    --text: #eceef1; --text-2: #c3c8d0; --muted: #959ca6; --faint: #6b727c;
    --ring: #9db8e6; --link: #8ab4ff;
    --brand: #23447a; --brand-hover: #2c5291; --focus-glow: rgba(157, 184, 230, .25); --check: #6f93d0;
    --danger: #f87171; --danger-soft: #2a1414;
    --overlay: rgba(0, 0, 0, .6);
    --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
    --side-bg: #0a0b0d;
    --chat-bg: #0f1114; --bubble-in: #1b1e23; --bubble-ai: #132219; --bubble-ai-border: #1e3a28; --bubble-staff: #141d2e; --bubble-staff-border: #22324f;
    --gray-bg: #23272e; --gray-fg: #b9c0ca;
    --green-bg: #12291c; --green-fg: #6ee7a0;
    --blue-bg: #13213b; --blue-fg: #93b4ff;
    --indigo-bg: #1b1d3a; --indigo-fg: #a5b4fc;
    --violet-bg: #231a3a; --violet-fg: #c4b5fd;
    --amber-bg: #2d2010; --amber-fg: #fbbf5a;
    --orange-bg: #301a10; --orange-fg: #fdab7a;
    --teal-bg: #0f2a28; --teal-fg: #5eead4;
    --cyan-bg: #0d2730; --cyan-fg: #67d8f0;
    --red-bg: #2d1414; --red-fg: #fca5a5;
    --navy-bg: #1a2a45; --navy-fg: #b4c8ec;
    color-scheme: dark;
}

/* Task Manager notifications: a button in the tab row beside Meetings, with a dropdown list */
.tabs-row { display: flex; align-items: flex-end; gap: 12px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tasks-page .tabs-row .tabs { border-bottom: 0; margin-bottom: 0; min-width: 0; overflow-y: hidden; scrollbar-width: none; }
.tasks-page .tabs-row .tabs::-webkit-scrollbar { display: none; }
.tasks-page .tabs-row .tab { margin-bottom: 0; }
.notify-slot { position: relative; flex: none; align-self: center; padding-bottom: 2px; }
.notify { position: relative; }
.notify-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 99px; background: var(--surface); color: var(--text); font-weight: 650; cursor: pointer; box-shadow: var(--shadow-sm); transition: background .15s; }
.notify-btn:hover { background: var(--surface-2); }
.notify-btn .icon { width: 18px; height: 18px; }
.notify-btn.has-unread { background: var(--danger); border-color: var(--danger); color: #fff; animation: notify-halo 2.4s ease-out infinite; }
.notify-btn.has-unread:hover { filter: brightness(.94); }
.notify-btn.has-unread .icon { animation: notify-ring 2.4s ease-in-out infinite; transform-origin: 50% 2px; }
.notify-btn.ping { animation: notify-pop .6s ease-out 3; }
.notify-count { min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 99px; background: #fff; color: var(--danger); font-size: 12px; font-weight: 800; }
@keyframes notify-halo { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes notify-ring { 0%, 60%, 100% { rotate: 0deg; } 65% { rotate: 14deg; } 72% { rotate: -12deg; } 79% { rotate: 8deg; } 86% { rotate: -4deg; } }
@keyframes notify-pop { 50% { transform: scale(1.12); } }
.notify-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: min(420px, calc(100vw - 32px)); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.notify-panel[hidden] { display: none; }
.notify-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; }
.notify-panel h2 { font-size: 17px; }
.notify-head-actions { display: flex; align-items: center; gap: 4px; }
.notify-filters { display: flex; gap: 6px; padding: 0 16px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.notify-filters button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 99px;
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.notify-filters button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.notify-filters em { font-style: normal; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; text-align: center; }
.notify-filters em:empty { display: none; }
.notify-list { max-height: min(460px, calc(100dvh - 260px)); overflow-y: auto; overscroll-behavior: contain; }
.notify-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; width: 100%; padding: 12px 16px; text-align: left;
  border: 0; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; background: var(--surface); color: var(--text); cursor: pointer; }
.notify-item:hover { background: var(--surface-2); }
.notify-item.unread { background: color-mix(in srgb, var(--violet-bg) 70%, var(--surface)); border-left-color: var(--c, var(--violet-fg)); }
.notify-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--bg-c, var(--violet-bg)); color: var(--c, var(--violet-fg)); }
.notify-icon .icon { width: 17px; height: 17px; }
.notify-item.tone-red { --c: var(--red-fg); --bg-c: var(--red-bg); }
.notify-item.tone-orange { --c: var(--orange-fg); --bg-c: var(--orange-bg); }
.notify-item.tone-amber { --c: var(--amber-fg); --bg-c: var(--amber-bg); }
.notify-item.tone-blue { --c: var(--blue-fg); --bg-c: var(--blue-bg); }
.notify-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.notify-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.notify-meta .badge { height: 20px; font-size: 11.5px; font-weight: 700; }
.notify-meta time { margin-left: auto; color: var(--muted); font-size: 12px; }
.notify-text strong { overflow-wrap: anywhere; }
.notify-item:not(.unread) strong { font-weight: 550; color: var(--text-2); }
.notify-text small { color: var(--muted); font-size: 12px; }
.notify-dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--danger); }
.notify-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 28px 16px; color: var(--muted); }
.notify-list > .btn { margin: 0 16px 16px; }
@media (max-width: 700px) {
  .notify-btn span:not(.notify-count) { display: none; }
  .notify-btn { padding: 0 11px; }
  .notify-panel { position: fixed; top: auto; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: auto; max-height: 80dvh; }
  .notify-list { max-height: calc(80dvh - 120px); }
}
.meet-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }
/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; background: var(--bg); color: var(--text);
       -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
[hidden] { display: none !important; }
body:has(.shell) { overflow: hidden; } /* the app scrolls inside each module, never the window */
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
       border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap;
       transition: background .15s, border-color .15s, box-shadow .15s; position: relative; }
.btn .icon { width: 17px; height: 17px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.danger-outline { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger-outline:hover { background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.sm .icon { width: 15px; height: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
                      border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent; animation: spin .7s linear infinite; }
.btn.primary.loading::after { border-color: var(--brand-ink) transparent var(--brand-ink) transparent; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0;
            background: transparent; color: var(--muted); flex: 0 0 auto; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .icon { width: 19px; height: 19px; }

/* ---------- Forms ---------- */
.form { display: block; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--text-2); box-shadow: 0 0 0 3px var(--focus-glow); }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.hint { color: var(--muted); font-size: 12px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 0; margin: 0 0 4px; }
.form-error:empty { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--check); margin: 0; }
.search-field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px;
                background: var(--surface-3); border: 1px solid transparent; color: var(--muted); transition: border-color .15s, background .15s; }
.search-field:focus-within { background: var(--surface); border-color: var(--border-strong); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; height: 100%; color: var(--text); }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px;
              border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: transform .2s; }
.switch input:checked + span { background: #16a34a; }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }

.callout { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
           background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 13px; margin-bottom: 16px; }
.callout .icon { color: var(--muted); }
.callout > span { flex: 1; }
.callout.warn { background: var(--amber-bg); border-color: transparent; color: var(--amber-fg); }
.callout.warn .icon { color: inherit; }
.callout.info { background: var(--blue-bg); border-color: transparent; color: var(--blue-fg); }
.callout.info .icon { color: inherit; }

/* ---------- Badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
         font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-bg); color: var(--gray-fg); }
.badge .icon { width: 13px; height: 13px; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.gray { background: var(--gray-bg); color: var(--gray-fg); }
.badge.green { background: var(--green-bg); color: var(--green-fg); }
.badge.blue { background: var(--blue-bg); color: var(--blue-fg); }
.badge.indigo { background: var(--indigo-bg); color: var(--indigo-fg); }
.badge.violet { background: var(--violet-bg); color: var(--violet-fg); }
.badge.amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge.orange { background: var(--orange-bg); color: var(--orange-fg); }
.badge.teal { background: var(--teal-bg); color: var(--teal-fg); }
.badge.cyan { background: var(--cyan-bg); color: var(--cyan-fg); }
.badge.red { background: var(--red-bg); color: var(--red-fg); }
.badge.navy { background: var(--navy-bg); color: var(--navy-fg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px;
        background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip .icon { width: 13px; height: 13px; color: var(--muted); }
.chip em { font-style: normal; color: var(--muted); font-weight: 500; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }

/* ---------- Avatars ---------- */
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
          font-weight: 700; font-size: 14px; letter-spacing: .02em; color: #fff; background: #6b7280; }
.avatar .icon { width: 20px; height: 20px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.avatar.tone-0 { background: #2563eb; } .avatar.tone-1 { background: #7c3aed; } .avatar.tone-2 { background: #db2777; }
.avatar.tone-3 { background: #ea580c; } .avatar.tone-4 { background: #0d9488; } .avatar.tone-5 { background: #16a34a; }
.avatar.tone-6 { background: #0891b2; } .avatar.tone-7 { background: #4f46e5; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px 12px; min-height: 0; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #fff; flex: 0 0 auto;
              box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.brand-mark img { width: 62%; height: 62%; object-fit: contain; display: block; }
.brand-mark.small { width: 30px; height: 30px; border-radius: 8px; }
.login-card .brand-mark { background: var(--navy-bg); box-shadow: none; }
:root[data-theme="dark"] .login-card .brand-mark { background: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: var(--side-strong); font-size: 15px; letter-spacing: -.01em; }
.brand-text span { font-size: 12px; color: var(--side-text); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 10px; border: 0; background: none;
            color: var(--side-text); font-weight: 500; font-size: 14px; text-decoration: none; width: 100%; text-align: left; position: relative; transition: background .15s, color .15s; }
.nav-item .icon { width: 19px; height: 19px; }
.nav-item:hover { background: var(--side-hover); color: var(--side-strong); text-decoration: none; }
.nav-item.active { background: #162B4E; color: #fff; }
.nav-item.active .icon { color: var(--brand-tint); }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-tint); }
.nav-foot { margin-top: auto; border-top: 1px solid var(--side-border); padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.login-theme { position: fixed; top: 16px; right: 16px; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-option { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.theme-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--ring); box-shadow: 0 0 0 3px var(--focus-glow); }
.theme-option:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.theme-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.theme-label .icon { width: 16px; height: 16px; color: var(--muted); }
.theme-preview { display: grid; grid-template-columns: 28% 1fr; grid-template-rows: 1fr 1fr; gap: 4px; height: 64px; padding: 6px; border-radius: 8px; }
.theme-preview i { border-radius: 4px; }
.theme-preview i:first-child { grid-row: span 2; }
.theme-light .theme-preview { background: #f4f5f7; } .theme-light .theme-preview i { background: #fff; } .theme-light .theme-preview i:first-child { background: #121316; }
.theme-dark .theme-preview { background: #0c0d10; } .theme-dark .theme-preview i { background: #1a1d22; } .theme-dark .theme-preview i:first-child { background: #0a0b0d; }
.theme-system .theme-preview { background: linear-gradient(135deg, #f4f5f7 50%, #0c0d10 50%); } .theme-system .theme-preview i { background: rgba(127, 127, 127, .35); } .theme-system .theme-preview i:first-child { background: #121316; }
@media (max-width: 760px) { .theme-options { gap: 8px; } .theme-preview { height: 48px; } .theme-label { font-size: 13px; } }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .04); min-width: 0; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text strong { color: var(--side-strong); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: none; }
.view { flex: 1; min-height: 0; overflow-y: auto; outline: none; }
.view.fill { overflow: hidden; display: flex; }
.view-loading { display: grid; place-items: center; padding: 64px 0; flex: 1; }
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 35; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--text-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Pages ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: 28px 32px 48px; }
.page.narrow-page { max-width: 960px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head.padded { padding: 20px 22px 0; }
.card-head h2 { font-size: 17px; font-weight: 650; }
.card-head p { color: var(--muted); margin-top: 3px; font-size: 13px; }
.card-section { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 18px; }
.card-section h3 { font-size: 14px; margin-bottom: 10px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar.padded { padding: 16px 22px; }
.toolbar .search-field { flex: 1; min-width: 220px; max-width: 420px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--ring); }
.tab .icon { width: 16px; height: 16px; }

.profile { display: flex; align-items: center; gap: 18px; }
.profile-text h2 { font-size: 19px; }
.profile-text p { color: var(--muted); margin: 2px 0 8px; }
.access-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.access-list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.access-list li .icon { color: var(--muted); margin-top: 1px; }
.access-list li span { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.access-list li strong { color: var(--text); font-size: 14px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
            padding: 11px 16px; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table th.actions, .table td.actions { text-align: right; width: 1%; white-space: nowrap; }
.table th.sortable button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.table th.sortable .icon { width: 14px; height: 14px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .avatar { width: 36px; height: 36px; font-size: 12px; }

/* ---------- Modals ---------- */
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
               width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; }
dialog.modal:not([open]) { display: none; }
dialog.modal.small { width: min(420px, calc(100vw - 32px)); }
dialog.modal.wide { width: min(760px, calc(100vw - 32px)); }
dialog.modal.xwide { width: min(1000px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 18px; font-weight: 650; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.modal-head .icon-btn { margin: -6px -8px 0 0; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-foot .spacer { flex: 1; }
.confirm { text-align: center; padding-top: 28px; }
.confirm h2 { font-size: 18px; margin: 14px 0 6px; }
.confirm p { color: var(--muted); }
.confirm-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--blue-bg); color: var(--blue-fg); }
.confirm-icon.danger { background: var(--red-bg); color: var(--red-fg); }
.confirm-icon .icon { width: 24px; height: 24px; }

.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 8px; margin: 0; min-width: 0; }
.perm-group legend { display: flex; align-items: center; gap: 8px; font-weight: 650; padding: 0 6px; margin-left: -6px; }
.perm-group legend .icon { width: 16px; height: 16px; color: var(--muted); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 12px;
         background: #15171b; color: #f4f5f7; box-shadow: var(--shadow-lg); font-weight: 500; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast .icon { color: #4ade80; }
.toast.error .icon { color: #f87171; }

/* ---------- Empty / error / skeleton ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 56px 24px; margin: auto; max-width: 420px; }
.empty-state .empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--surface-3); color: var(--muted); margin-bottom: 8px; }
.empty-state .empty-icon .icon { width: 26px; height: 26px; }
.empty-state h3 { font-size: 16px; }
.empty-state p { color: var(--muted); }
.empty-state .btn { margin-top: 12px; }
.empty-state.error .empty-icon { background: var(--red-bg); color: var(--red-fg); }
.skeleton-row { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skel.circle { width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel.w60 { width: 60%; } .skel.w90 { width: 90%; } .skel.w40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Chats ---------- */
.chats { display: grid; grid-template-columns: 360px minmax(0, 1fr); flex: 1; min-height: 0; min-width: 0; }
.chat-list { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 16px 12px 20px; }
.pane-head h1 { font-size: 20px; font-weight: 700; }
.pane-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.chat-list > .search-field { margin: 0 16px 10px; }
.conv-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.list-foot { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 20px; border: 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; text-align: left; }
.list-foot:hover { background: var(--surface-2); }
.list-foot .icon { width: 16px; height: 16px; }
.list-foot .count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.blocked-add textarea { min-height: 76px; }
.blocked-add .actions { display: flex; justify-content: flex-end; }
.blocked-list { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--border); }
.blocked-list li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.blocked-list .phrase { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.blocked-list .by { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 560px) { .blocked-list .by { display: none; } }
.conv { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 0; background: none; text-align: left; border-radius: 12px; transition: background .12s; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--surface-3); }
.conv-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.conv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.conv-preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; min-width: 0; }
.conv-preview .icon { width: 14px; height: 14px; }
.conv-preview .pfx { color: var(--text-2); font-weight: 500; }
.conv-count { flex: 0 0 auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 600; display: grid; place-items: center; }

.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--chat-bg); }
.chat-placeholder { flex: 1; display: flex; }
.chat-open { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 68px; }
.chat-head .back { display: none; margin-left: -8px; }
.chat-title { flex: 1; min-width: 0; }
.chat-title .name { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.chat-title .meta > a, .chat-title .meta > span:not(.badge) { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.chat-title .meta a:hover { color: var(--text); }
.chat-title .meta .icon { width: 13px; height: 13px; }
.chat-title .meta .badge { height: 20px; font-size: 11px; }
.chat-actions { display: flex; gap: 8px; align-items: center; }
.bot-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border: 1px solid var(--border); border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.bot-toggle-label { display: inline-flex; align-items: center; gap: 5px; }
.bot-toggle-label .icon { width: 14px; height: 14px; }
.bot-toggle .switch { width: 38px; height: 22px; }
.bot-toggle .switch span::after { width: 16px; height: 16px; }
.bot-toggle .switch input:checked + span::after { transform: translateX(16px); }
.bot-toggle .switch input:disabled + span { cursor: not-allowed; opacity: .6; }
.conv-flag { flex: 0 0 auto; font-size: 10.5px; font-weight: 650; padding: 1px 7px; border-radius: 99px; background: var(--amber-bg); color: var(--amber-fg); margin: 0 6px; }
.lead-strip { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.lead-strip > .icon { color: var(--green-fg); }
.lead-strip .grow { flex: 1; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding: 20px clamp(16px, 5%, 64px); display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; position: sticky; top: 0; z-index: 1; margin: 12px 0 6px; }
.day span { display: inline-block; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 99px; box-shadow: var(--shadow-sm); }
.bubble { max-width: min(72%, 620px); padding: 8px 12px 20px; border-radius: 14px; position: relative; word-wrap: break-word;
          box-shadow: var(--shadow-sm); min-width: 120px; border: 1px solid var(--border); }
.bubble .text { white-space: pre-wrap; }
.bubble .text:empty { display: none; }
.bubble.in { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 4px; }
.bubble.out { align-self: flex-end; border-top-right-radius: 4px; }
.bubble.ai { background: var(--bubble-ai); border-color: var(--bubble-ai-border); }
.bubble.staff { background: var(--bubble-staff); border-color: var(--bubble-staff-border); }
.bubble.pending { opacity: .6; }
.bubble.context { opacity: .6; }
.bubble .who { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; color: var(--text-2); margin-bottom: 3px; }
.bubble .who .icon { width: 13px; height: 13px; }
.bubble.ai .who { color: var(--green-fg); }
.bubble.staff .who { color: var(--blue-fg); }
.bubble .who .tag { margin-left: 4px; font-weight: 500; }
.bubble .who .tag.blocked { background: var(--red-bg); color: var(--red-fg); }
.bubble .stamp { position: absolute; right: 10px; bottom: 4px; font-size: 11px; color: var(--muted); }
.bubble img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: 4px 0 6px; cursor: zoom-in; background: var(--surface-3); }
.bubble .broken { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 6px 0; }
.bubble .broken .icon { width: 14px; height: 14px; }
.readonly-note { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 20px; background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.readonly-note .icon { width: 15px; height: 15px; }

.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.composer .notice { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; padding: 9px 12px; border-radius: 10px; margin-bottom: 10px; background: var(--amber-bg); color: var(--amber-fg); }
.composer .notice .icon { width: 15px; height: 15px; margin-top: 1px; }
.composer .notice.muted { background: var(--surface-3); color: var(--muted); margin-bottom: 0; }
.composer-bar { display: flex; align-items: flex-end; gap: 6px; background: var(--surface-3); border-radius: 14px; padding: 5px; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.composer-bar:focus-within { background: var(--surface); border-color: var(--border-strong); }
.composer textarea { flex: 1; resize: none; border: 0; background: transparent; padding: 9px 6px; max-height: 160px; min-height: 38px; outline: none; line-height: 1.4; }
.send-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: var(--brand); color: var(--brand-ink); flex: 0 0 auto; transition: background .15s; }
.send-btn:hover { background: var(--brand-hover); }
.send-btn:disabled { background: var(--border); color: var(--faint); cursor: not-allowed; }
.send-btn .icon { width: 17px; height: 17px; }
.attachment { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px; margin-bottom: 10px; }
.attachment img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.attachment .meta { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); }
.attachment .meta .fname { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send-error { color: var(--danger); font-size: 12.5px; margin: 0 0 8px; }

.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); display: grid; place-items: center; z-index: 90; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 8px; }
.lightbox .icon-btn { position: absolute; top: 16px; right: 16px; color: #fff; background: rgba(255, 255, 255, .12); }

/* ---------- Utilities ---------- */
.faint { color: var(--faint); }
.min0 { min-width: 0; }
.grow { flex: 1; }
.block { display: block; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon.flip { transform: rotate(180deg); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); min-height: 78px; }
.stat > .skel { flex: 1; }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-icon.navy { background: var(--navy-bg); color: var(--navy-fg); }
.stat-icon.blue { background: var(--blue-bg); color: var(--blue-fg); }
.stat-icon.amber { background: var(--amber-bg); color: var(--amber-fg); }
.stat-icon.green { background: var(--green-bg); color: var(--green-fg); }
.stat-icon.violet { background: var(--violet-bg); color: var(--violet-fg); }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat-label .muted { color: var(--faint); font-size: 12px; }

/* ---------- Filters ---------- */
.filters { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.filter-main { display: flex; gap: 10px; }
.filter-main .search-field { flex: 1; max-width: 520px; }
.filter-toggle { display: none; }
.filter-toggle .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: 11px; padding: 0 6px; }
.filter-more { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.select-field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; flex: 1 1 150px; max-width: 220px; }
.select-field > span { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.select-field select, .select-field input { height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); outline: none; min-width: 0; }
.select-field select:focus, .select-field input:focus { border-color: var(--text-2); box-shadow: 0 0 0 3px var(--focus-glow); }
.filter-more [data-clear] { height: 38px; }

/* ---------- Lead table & cards ---------- */
.lead-table .table { min-width: 940px; }
@media (max-width: 1480px) { .col-notes { display: none; } }
.lead-table .table th:first-child, .lead-table .table td:first-child { padding-left: 20px; }
.lead-table tbody tr { cursor: pointer; }
.lead-table td { max-width: 240px; }
.lead-table .person .strong { max-width: 180px; }
.contact-cell { max-width: 210px; }
.notes-cell { max-width: 220px; color: var(--text-2); font-size: 13px; }
.lead-cards { display: none; }
.lead-card { display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 14px 16px; }
.lead-card:active { background: var(--surface-2); }
.lead-card { cursor: pointer; }
.status-btn { border: 1px solid transparent; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; transition: border-color .15s, box-shadow .15s, filter .15s; }
.status-btn .icon { width: 11px; height: 11px; opacity: .55; margin-left: 2px; }
.status-btn:hover { border-color: currentColor; }
.status-btn:hover .icon { opacity: 1; }
.status-btn:active { filter: brightness(.95); }
.status-btn:disabled { cursor: progress; opacity: .8; }
.lead-card-top { display: flex; align-items: center; gap: 10px; width: 100%; }
.lead-card-line { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; color: var(--text-2); font-size: 13.5px; min-width: 0; }
.lead-card-line .icon { width: 14px; height: 14px; color: var(--muted); margin-right: 4px; vertical-align: -2px; }
.lead-card-line > span { display: inline-flex; align-items: center; min-width: 0; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 13px; }
.pager-controls { display: flex; align-items: center; gap: 6px; }
.pager select { height: 30px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); margin: 0 8px 0 4px; padding: 0 6px; }
.pager .icon-btn { width: 34px; height: 34px; border: 1px solid var(--border); }
.pager .icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Drawer ---------- */
dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(480px, 100vw); max-width: 100vw; border: 0; padding: 0;
                background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
dialog.drawer:not([open]) { display: none; }
dialog.drawer::backdrop { background: var(--overlay); }
dialog.drawer[open] { animation: slide-in .22s ease-out; }
@keyframes slide-in { from { transform: translateX(32px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 20px 18px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 19px; margin: 4px 0 8px; }
.drawer-head .icon-btn { margin: -4px -6px 0 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.drawer-section { padding: 16px 0; border-bottom: 1px solid var(--border); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 18px 112px minmax(0, 1fr); gap: 10px; align-items: start; padding: 6px 0; }
.kv > .icon { width: 16px; height: 16px; color: var(--faint); margin-top: 2px; }
.kv-label { color: var(--muted); font-size: 13px; }
.kv-value { min-width: 0; word-break: break-word; }
.kv-value a { display: inline-flex; align-items: center; gap: 4px; }
.kv-value a .icon { width: 13px; height: 13px; }
.copyable { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer; }
.copy-btn:hover { background: var(--surface-3); color: var(--text); }
.copy-btn:focus-visible { outline: none; box-shadow: var(--focus-glow); }
.copy-btn.done { color: var(--green-fg); }
.copy-btn .icon { width: 14px; height: 14px; }
.sr-copy { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
.notes { white-space: pre-wrap; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 6px 0; position: relative; font-size: 13.5px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 4px; top: 20px; bottom: -6px; width: 2px; background: var(--border); }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); margin-top: 5px; flex: 0 0 auto; }
.tl-dot.bot { background: var(--green-fg); }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Lead form ---------- */
.form-section { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 12px; padding-top: 4px; }
.form-section:not(:first-of-type) { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 4px; }
.static { display: flex; align-items: center; height: 40px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong); font-weight: 600; font-size: 13.5px; color: var(--text-2); background: var(--surface); transition: all .15s; }
.segmented span .icon { width: 15px; height: 15px; }
.segmented input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.segmented input:checked + span { border-color: var(--text-2); background: var(--surface-3); color: var(--text); }
.segmented label.orange input:checked + span { background: var(--orange-bg); color: var(--orange-fg); border-color: currentColor; }
.segmented label.violet input:checked + span { background: var(--violet-bg); color: var(--violet-fg); border-color: currentColor; }
.picker { position: relative; }
.picker-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 5px 8px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: text; }
.picker-box:focus-within { border-color: var(--text-2); box-shadow: 0 0 0 3px var(--focus-glow); }
.picker-box input { flex: 1; min-width: 140px; border: 0 !important; outline: none; height: 28px !important; padding: 0 4px !important; box-shadow: none !important; background: transparent; }
.picker-chips { display: contents; }
.picker-chips .chip { background: var(--navy-bg); color: var(--navy-fg); padding-right: 4px; }
.picker-chips .chip button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 6px; background: none; color: inherit; padding: 0; }
.picker-chips .chip button:hover { background: rgba(0, 0, 0, .08); }
.picker-chips .chip .icon { width: 12px; height: 12px; color: inherit; }
.picker-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; list-style: none; margin: 0; padding: 6px; max-height: 260px; overflow-y: auto;
               background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.picker-menu li[role=option] { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.picker-menu li[role=option].active, .picker-menu li[role=option]:hover { background: var(--surface-3); }
.picker-empty { padding: 12px 10px; color: var(--muted); font-size: 13px; }
.dupes { align-items: flex-start; }
.dupes > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.dupes ul { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dupes li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text); }
.dupes a { font-weight: 600; }
.lead-flag { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--green-fg); }
.lead-flag .icon { width: 16px; height: 16px; }
.lead-strip .btn .icon { width: 15px; height: 15px; }

/* ---------- Projects ---------- */
.segmented label.green input:checked + span { background: var(--green-bg); color: var(--green-fg); border-color: currentColor; }
.list-toolbar { margin-bottom: 18px; justify-content: space-between; }
.list-toolbar .search-field { background: var(--surface); border-color: var(--border); }
.seg-tabs { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); gap: 2px; }
.seg-tabs button { border: 0; background: none; height: 32px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.project-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
                color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s; }
a.project-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.pc-cover { position: relative; aspect-ratio: 16 / 10; background: var(--surface-3); overflow: hidden; }
.pc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint);
                  background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); }
.pc-placeholder .icon { width: 44px; height: 44px; stroke-width: 1.5; }
.pc-status { position: absolute; top: 12px; left: 12px; }
.pc-status .badge { box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.pc-count { position: absolute; bottom: 10px; right: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px;
            background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 600; }
.pc-count .icon { width: 13px; height: 13px; }
.pc-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.pc-body h3 { font-size: 16px; font-weight: 650; }
.pc-body p { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.pc-body p .icon { width: 14px; height: 14px; }
.pc-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; font-size: 13px; color: var(--text-2); }
.pc-facts span { display: inline-flex; align-items: center; gap: 5px; }
.pc-facts .icon { width: 14px; height: 14px; color: var(--muted); }
.skeleton-card .skel.cover { aspect-ratio: 16 / 10; height: auto; border-radius: 0; }
.skeleton-card .pc-body { gap: 10px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.back-link:hover { color: var(--text); text-decoration: none; }
.back-link .icon { width: 16px; height: 16px; }
.head-chips { margin-top: 10px; }
.chip.link { color: var(--link); }
.chip.link:hover { text-decoration: none; background: var(--blue-bg); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.fact { display: flex; gap: 10px; align-items: flex-start; }
.fact > .icon { width: 18px; height: 18px; color: var(--faint); margin-top: 2px; }
.fact span { display: block; font-size: 12px; color: var(--muted); }
.fact strong { font-weight: 600; font-size: 14px; }
.sub-h { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.sub-h + .chips { margin-bottom: 14px; }
.padded-box { padding: 0 22px 8px; }
.units-table td, .units-table th { white-space: nowrap; }
.ai-card .card-head h2 { display: flex; align-items: center; gap: 8px; }
.ai-card .card-head h2 .icon { color: var(--navy-fg); }
.ai-line { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; line-height: 1.6; padding: 14px; border-radius: var(--radius-sm);
           background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-2); word-break: break-word; margin-bottom: 10px; }
.sticky { position: sticky; top: 20px; }
.editor-actions { display: flex; gap: 8px; margin-top: 6px; }
.editor-actions .btn { flex: 1; }
.units-editor { display: flex; flex-direction: column; gap: 10px; }
.unit-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.1fr) repeat(4, minmax(0, .7fr)) 38px; gap: 10px; align-items: end;
            padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.unit-row .field { margin: 0; }
.unit-row .field label { font-size: 12px; }
.unit-row .icon-btn { margin-bottom: 1px; }
.unit-row .icon-btn:hover { color: var(--danger); background: var(--danger-soft); }
.units-empty { padding: 6px 0; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px; border: 2px dashed var(--border-strong); border-radius: var(--radius);
            color: var(--muted); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--text-2); background: var(--surface-2); }
.dropzone .icon { width: 26px; height: 26px; }
.dropzone strong { color: var(--text); }
.dropzone:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.photo-grid:empty { display: none; }
.photo { position: relative; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.photo.cover { border-color: var(--ring); box-shadow: 0 0 0 2px var(--focus-glow); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.cover-badge { position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-size: 11.5px; font-weight: 700; }
.cover-badge .icon { width: 12px; height: 12px; }
.photo-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.photo-tools .icon-btn { width: 30px; height: 30px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; }
.photo-tools .icon-btn:hover { background: rgba(0, 0, 0, .75); color: #fff; }
.photo-tools .icon-btn.danger:hover { background: var(--danger); }
.photo-tools .icon { width: 15px; height: 15px; }
.photo .caption { width: 100%; border: 0; border-top: 1px solid var(--border); padding: 9px 10px; font-size: 13px; outline: none; background: var(--surface); }
.photo .caption:focus { background: var(--surface-2); }
.tag-box .chip { background: var(--surface-3); color: var(--text-2); }
.field input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.lb-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #d1d5db; font-size: 13px; }

/* ---------- CRM Dashboard ---------- */
:root { --mx-0: #eef2f8; --mx-1: #cbd8ec; --mx-2: #93add6; --mx-3: #4f76b3; --mx-4: #1d3a68; --mx-ink-light: #ffffff; }
:root[data-theme="dark"] { --mx-0: #1a2232; --mx-1: #1f3657; --mx-2: #2c5185; --mx-3: #4d77b8; --mx-4: #8fb0e3; }
.crm { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.crm-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 20px 24px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.crm-title h1 { font-size: 22px; font-weight: 700; }
.crm-title p { font-size: 12.5px; margin-top: 2px; }
.crm-head-right { display: flex; gap: 10px; }
.crm-stat { display: flex; flex-direction: column; align-items: flex-end; padding: 6px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); min-width: 110px; }
.crm-stat span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.crm-stat strong { font-size: 19px; letter-spacing: -.02em; }
.crm-stat.accent { background: var(--navy-bg); border-color: transparent; }
.crm-stat.accent strong, .crm-stat.accent span { color: var(--navy-fg); }
.crm-tabs { grid-column: 1 / -1; margin: 8px 0 0; border-bottom: 0; }
.crm-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.crm-body > .page { flex: 1; overflow-y: auto; width: 100%; max-width: none; }
.crm-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.crm-layout.panel-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.crm-layout.panel-collapsed .crm-filters { visibility: hidden; }
.crm-filters { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); overflow: hidden; }
.crm-fhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--border); }
.crm-fhead h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.crm-fhead h2 .icon { width: 16px; height: 16px; color: var(--muted); }
.crm-fclose { display: none; }
.crm-fscroll { flex: 1; overflow-y: auto; }
.crm-fsec { border-bottom: 1px solid var(--border); }
.crm-ftitle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 13px 18px; border: 0; background: none; font-weight: 650; font-size: 13.5px; text-align: left; }
.crm-ftitle > span:first-child { flex: 1; display: inline-flex; align-items: center; gap: 8px; }
.crm-ftitle .icon { width: 15px; height: 15px; color: var(--muted); }
.crm-ftitle .chev { transition: transform .2s; }
.crm-fsec.closed .chev { transform: rotate(-90deg); }
.crm-fsec.closed .crm-fbody { display: none; }
.crm-fcount { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: 11px; display: inline-grid; place-items: center; }
.crm-fbody { padding: 0 18px 14px; }
.crm-fsearch { width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); margin-bottom: 8px; outline: none; }
.crm-fsearch:focus { border-color: var(--text-2); box-shadow: 0 0 0 3px var(--focus-glow); }
.crm-checks { display: flex; flex-direction: column; max-height: 230px; overflow-y: auto; margin: 0 -6px; }
.crm-check { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.crm-check:hover { background: var(--surface-2); }
.crm-check input { width: 16px; height: 16px; accent-color: var(--check); margin: 0; flex: 0 0 auto; }
.crm-check-label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-check-n { font-size: 11.5px; color: var(--muted); background: var(--surface-3); padding: 1px 7px; border-radius: 99px; }
.dotmark { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--gray-fg); }
.dotmark.green { background: var(--green-fg); } .dotmark.blue { background: var(--blue-fg); } .dotmark.indigo { background: var(--indigo-fg); }
.dotmark.red { background: var(--red-fg); } .dotmark.orange { background: var(--orange-fg); } .dotmark.teal { background: var(--teal-fg); }
.dotmark.violet { background: var(--violet-fg); } .dotmark.amber { background: var(--amber-fg); }
.crm-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crm-dates label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.crm-dates input { height: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); min-width: 0; }
.crm-factions { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.crm-factions .btn { width: 100%; }
.crm-table-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.crm-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; }
.crm-toolbar .search-field { flex: 1; max-width: 560px; background: var(--surface); border-color: var(--border); }
.crm-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.crm-filter-btn .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: 11px; padding: 0 6px; }
.crm-warning { display: flex; align-items: center; gap: 8px; margin: 0 20px 10px; padding: 9px 12px; border-radius: 10px; background: var(--amber-bg); color: var(--amber-fg); font-size: 13px; }
.crm-warning .icon { width: 16px; height: 16px; }
.crm-table-wrap { flex: 1; min-height: 0; overflow: auto; margin: 0 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.crm-table { min-width: 980px; }
.crm-table th, .crm-table td { padding-left: 11px; padding-right: 11px; }
.crm-table th { font-size: 11.5px; }
.crm-table thead th { position: sticky; top: 0; z-index: 1; border-top: 0; }
.crm-table th.num, .crm-table td.num { width: 1%; text-align: right; padding-right: 8px; }
.crm-table th.sortable button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.crm-table th.sorted { color: var(--text); }
.crm-table .sort-idle { color: var(--faint); font-size: 12px; }
.crm-table tbody tr { cursor: pointer; }
.crm-table td { padding-top: 11px; padding-bottom: 11px; }
.cell-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-agent { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-clip { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.crm-cards { display: none; }
.crm-pager { margin: 0 20px 16px; background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.crm-pager .icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.crm-pager .icon-btn .icon { width: 16px; height: 16px; }
.crm-pager .icon-btn .dbl { margin-left: -10px; }
.history-now { margin-bottom: 10px; }
.history-since { margin-top: 8px; }
.crm-pager select { margin: 0 4px 0 0; }
.tl-arrow { width: 14px; height: 14px; color: var(--faint); vertical-align: middle; margin: 0 2px; }
.move { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.crm-change-tools { margin-bottom: 14px; }
.select-field.inline { flex-direction: row; align-items: center; gap: 8px; max-width: 280px; }
.select-field.inline > span { white-space: nowrap; }
.crm-since { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.crm-since .icon { width: 14px; height: 14px; }
.small-value { font-size: 15px; }
.matrix { border-collapse: separate; border-spacing: 2px; margin: 0 16px 16px; font-size: 13px; }
.matrix th { font-weight: 600; padding: 6px 8px; text-align: center; white-space: nowrap; }
.matrix th[scope=row] { text-align: left; }
.matrix th.corner { color: var(--muted); font-size: 11.5px; text-align: left; }
.matrix td { padding: 0; text-align: center; min-width: 64px; height: 40px; }
.matrix .mx { width: 100%; height: 40px; border: 0; border-radius: 6px; font-weight: 700; font-size: 13.5px; cursor: pointer; color: var(--text); transition: outline-color .15s; outline: 2px solid transparent; outline-offset: 1px; }
.matrix .mx:hover, .matrix .mx.selected { outline-color: var(--ring); }
.mx-0 { background: var(--mx-0); } .mx-1 { background: var(--mx-1); } .mx-2 { background: var(--mx-2); }
.mx-3 { background: var(--mx-3); color: var(--mx-ink-light) !important; } .mx-4 { background: var(--mx-4); color: var(--mx-ink-light) !important; }
:root[data-theme="dark"] .mx-3 { color: #fff !important; }
:root[data-theme="dark"] .mx-4 { color: #0c1220 !important; }
.matrix .mx-zero { color: var(--faint); background: var(--surface-2); border-radius: 6px; }
.matrix .mx-self { color: var(--faint); background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface-3) 4px, var(--surface-3) 8px); border-radius: 6px; }
.matrix .tot { font-weight: 700; color: var(--text-2); padding: 0 10px; }
.matrix-legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.matrix-legend i { width: 18px; height: 12px; border-radius: 3px; display: inline-block; }
.changes-table tbody tr { cursor: pointer; }

/* ---------- Task Manager ---------- */
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.tasks-page .tabs { margin-bottom: 18px; overflow-x: auto; }
.tasks-page button.tab { background: none; border: 0; border-bottom: 2px solid transparent; }
.tasks-page button.tab.active { border-bottom-color: var(--ring); }
.head-who { display: flex; align-items: center; gap: 14px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; position: relative; }
.popover { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: min(340px, calc(100vw - 32px)); max-height: 420px; overflow-y: auto;
           background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px 14px; color: var(--text); }
.member-pop { left: auto; right: 0; width: min(360px, calc(100vw - 32px)); max-height: 440px; padding: 6px; }
.mp-mine, .mp-dept-btn, .mp-person { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; border-radius: 10px; color: var(--text); }
.mp-mine { padding: 8px 10px; font-weight: 600; }
.mp-dept { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.mp-dept-btn { padding: 9px 10px; font-weight: 650; }
.mp-dept-btn em { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 500; color: var(--muted); }
.mp-dept-btn .icon { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.mp-dept-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
.mp-people { display: flex; flex-direction: column; gap: 1px; padding: 0 0 6px 14px; }
.mp-person { padding: 6px 10px; }
.mp-person span { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.mp-person strong { font-size: 13.5px; }
.mp-person small { color: var(--muted); font-size: 12px; }
.mp-mine:hover, .mp-dept-btn:hover, .mp-person:hover { background: var(--surface-2); }
.mp-mine.on, .mp-person.on { background: var(--navy-bg); }
.tick { margin-left: auto; color: var(--navy-fg); }
.viewing-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius);
               background: var(--navy-bg); color: var(--navy-fg); font-size: 13.5px; }
.viewing-bar > span { flex: 1 1 260px; }

/* chips used in the task and user forms */
.task-form .label .hint { font-weight: 400; }
.tchips { display: flex; flex-wrap: wrap; gap: 8px; }
.tchip { --c: #64748b; position: relative; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 10px; border-radius: 99px;
         border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s; }
.tchip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tchip > i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.tchip:hover { border-color: var(--text-2); }
.tchip:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--text); box-shadow: inset 0 0 0 1px var(--c); }
.tchip.person:has(input:checked), .tchip.plain:has(input:checked) { --c: var(--ring); }
.tchip:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.tchip:has(input:disabled) { opacity: .5; cursor: default; }
.tchip.plain { padding: 0 12px; }
.tpill { --c: #9ca3af; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap;
         background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: color-mix(in srgb, var(--c) 70%, var(--text)); }
.tpill > i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: 0 0 auto; }

/* Task Board */
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 10px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.legend-label { color: var(--muted); }
.legend-item { --c: #9ca3af; display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { width: 14px; height: 10px; border-radius: 3px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.board-range { display: flex; align-items: center; gap: 10px; }
.board-hint { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.board-hint .icon { width: 14px; height: 14px; flex: 0 0 auto; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.bcol { --c: #64748b; display: flex; flex-direction: column; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-top: 3px solid var(--c); border-radius: var(--radius-lg); }
.bcol-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 700; font-size: 14px; }
.bcol-head i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.bcount { margin-left: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: 12px;
          display: inline-grid; place-items: center; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bcol-body { display: flex; flex-direction: column; gap: 12px; padding: 6px 12px 14px; min-height: 140px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); transition: background .15s, box-shadow .15s; }
.bcol-body.drop-over { background: color-mix(in srgb, var(--c) 10%, transparent); box-shadow: inset 0 0 0 2px var(--c); }
.bcol-empty { color: var(--faint); font-size: 13px; text-align: center; padding: 26px 0; border: 1px dashed var(--border-strong); border-radius: var(--radius); margin: 0; }
/* Border colour = priority; Emergency also pulses. */
.bcard { --p: #9ca3af; display: flex; flex-direction: column; gap: 9px; padding: 12px 12px 10px; background: var(--surface); cursor: pointer;
         border: 1.5px solid color-mix(in srgb, var(--p) 60%, var(--border)); border-left: 5px solid var(--p); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: box-shadow .15s, opacity .15s; }
.bcard:hover { box-shadow: var(--shadow-lg); }
.bcard.movable { cursor: grab; }
.bcard.movable:active { cursor: grabbing; }
.bcard.dragging { opacity: .4; }
.bcard.p-emergency { animation: task-pulse 1.8s ease-out infinite; }
@keyframes task-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--p) 50%, transparent); }
  70% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--p) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--p) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .bcard.p-emergency { box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 35%, transparent); } }
.bcard-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bsupport { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--navy-bg); color: var(--navy-fg); }
.bsupport .icon { width: 11px; height: 11px; }
.bcard-title { all: unset; display: block; cursor: pointer; font-weight: 650; font-size: 14.5px; line-height: 1.35; word-break: break-word; color: var(--text); }
.bcard-title:hover { text-decoration: underline; }
.bcard-title:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.bmeta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 0; font-size: 12.5px; }
.bmeta dt { color: var(--muted); }
.bmeta dd { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); font-weight: 600; }
.bmeta dd span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.bdue { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--text-2); }
.bdue .icon { width: 13px; height: 13px; }
.bdue.soon { color: var(--danger); }
/* Card foot: start date left, deadline right; the deadline is red until the task is finished. */
.bdue.deadline { color: var(--danger); font-weight: 700; }
.bdue.deadline.done { color: var(--muted); font-weight: 600; }
/* "Assigned by me" */
.btn.secondary.on { border-color: var(--ring); box-shadow: inset 0 0 0 1px var(--ring); background: var(--navy-bg); color: var(--navy-fg); }
.given-intro { flex: 1 1 260px; align-self: center; }
.who { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-2); }
.type-none { margin-bottom: 4px; }

/* Task Calendar */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.card.cal { padding: 16px; }
.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-head h2 { font-size: 18px; font-weight: 700; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; padding: 2px 0 4px; }
.cal-dow.weekend { color: var(--faint); }
.cday { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 92px; padding: 7px; border-radius: 10px; border: 1px solid var(--border);
        background: var(--surface); text-align: left; min-width: 0; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.cday:hover { border-color: var(--border-strong); }
.cday.weekend { background: var(--surface-2); }
.cday.out { opacity: .42; }
.dnum { align-self: flex-start; display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 99px; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.cday.today .dnum { background: var(--brand); color: var(--brand-ink); }
.cday.alert { background: var(--red-bg); border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.cday.alert .dnum { color: var(--red-fg); }
.cday.alert.today .dnum { background: var(--danger); color: #fff; }
.cday.sel { border-color: var(--ring); box-shadow: 0 0 0 2px var(--ring); }
.dtask { --p: #9ca3af; display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--text-2); min-width: 0; }
.dtask i { width: 7px; height: 7px; border-radius: 50%; background: var(--p); flex: 0 0 auto; }
.dtask span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtask.done span { text-decoration: line-through; color: var(--muted); }
.dmore { font-size: 11px; color: var(--muted); font-weight: 600; }
.ddots { display: none; gap: 3px; flex-wrap: wrap; }
.ddots i { --p: #9ca3af; width: 6px; height: 6px; border-radius: 50%; background: var(--p); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 12.5px; color: var(--text-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 7px; }
.cal-legend i { width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface); }
.cal-legend i.red { background: var(--red-bg); border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.cal-legend i.today { background: var(--brand); border-color: var(--brand); border-radius: 99px; }
.cal-side { position: sticky; top: 16px; }
.cal-side h2 { font-size: 16px; font-weight: 700; }
.cal-side > p { margin: 3px 0 14px; }
.due-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.due-item { --p: #9ca3af; width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 11px 12px; border-radius: var(--radius);
            background: var(--surface); color: var(--text); border: 1.5px solid color-mix(in srgb, var(--p) 55%, var(--border)); border-left: 5px solid var(--p); text-align: left; }
.due-item:hover { box-shadow: var(--shadow-lg); }
.due-item strong { font-size: 14px; line-height: 1.35; }
.due-top { display: flex; flex-wrap: wrap; gap: 6px; }
.side-empty { color: var(--muted); font-size: 13px; padding: 22px 0; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); margin: 4px 0; }

/* All Tasks */
.task-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 16px 18px; }
.task-filters .select-field.grow { flex: 2 1 200px; max-width: none; }
.people-filter { position: relative; max-width: 240px; flex-basis: 200px; }
.select-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
              color: var(--text); font-weight: 600; font-size: 13.5px; width: 100%; }
.select-btn .icon { width: 16px; height: 16px; color: var(--muted); }
.select-btn span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-pop { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 400; }
.pop-actions { display: flex; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.pgroup { border: 0; padding: 6px 0; margin: 0; border-bottom: 1px solid var(--border); }
.pgroup:last-child { border-bottom: 0; }
.pgroup .check.dept { font-weight: 700; }
.pgroup .check.dept em { font-style: normal; color: var(--muted); font-weight: 500; font-size: 12px; }
.pgroup-people { padding-left: 26px; }
.scope-note { display: flex; align-items: center; gap: 8px; margin: -6px 2px 12px; color: var(--muted); font-size: 13px; }
.scope-note .icon { width: 15px; height: 15px; }
.task-table { min-width: 860px; }
.task-table td { vertical-align: top; }
.task-table tbody tr { cursor: pointer; }
.task-table tbody td:first-child { box-shadow: inset 4px 0 0 var(--p, transparent); }
.task-table .date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ttitle { min-width: 240px; max-width: 420px; }
.link-btn { all: unset; cursor: pointer; font-weight: 650; color: var(--text); word-break: break-word; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.tsub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.tsub .who { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text-2); }
.table-foot { padding: 10px 18px; border-top: 1px solid var(--border); }
.table-foot:empty { display: none; }
.task-export { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; padding: 16px 18px; }
.task-export > div:first-child { flex: 1 1 220px; }
.export-btns { display: flex; gap: 8px; }
.overdue { color: var(--danger); font-weight: 700; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* View mode and the task form */
.modal-head-actions { display: flex; align-items: center; gap: 6px; margin: -4px -8px 0 0; flex: 0 0 auto; }
.modal-head-actions .icon-btn { margin: 0; }
.status-inline { height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; padding: 0 8px; }
.details { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; margin: 0 0 18px; }
.details dt { color: var(--muted); font-size: 13px; }
.details dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.section-title { font-size: 14px; font-weight: 700; margin: 6px 0 10px; }
.log { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.log li { position: relative; }
.log li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.log time { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.log p { white-space: pre-wrap; word-break: break-word; }
.sup-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.sup-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.sup-picked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.sup-picked .chip { background: var(--surface); border: 1px solid var(--border); padding-right: 4px; }
.chip-x { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); padding: 0; }
.chip-x:hover { background: var(--surface-3); color: var(--text); }
.chip-x .icon { width: 13px; height: 13px; }
.type-group + .type-group { margin-top: 10px; }
.type-group-name { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.notes { display: flex; flex-direction: column; gap: 10px; }
.note { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px 10px; background: var(--surface-2); }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; min-height: 24px; }
.note-head .icon-btn { width: 26px; height: 26px; }
.note-head .icon-btn .icon { width: 14px; height: 14px; }
.field .note textarea { min-height: 60px; }
.note-text { white-space: pre-wrap; word-break: break-word; }
.add-note { align-self: flex-start; margin-top: 8px; }

/* Settings: users (task access lists) and departments */
fieldset.perm-grid { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.perm-grid:disabled { opacity: .5; }
.perm-group.wide { grid-column: 1 / -1; }
.access-views { font-size: 12px; color: var(--muted); margin-top: 6px; }
.vtree { margin: 4px 0 8px 27px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.vtree > p { padding: 10px 12px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--border); }
.vdept { border-bottom: 1px solid var(--border); }
.vdept:last-child { border-bottom: 0; }
.vdept-row { display: flex; align-items: center; gap: 8px; padding: 2px 6px 2px 12px; }
.vdept-row .check { flex: 1; font-weight: 600; }
.vdept-row .icon-btn { width: 32px; height: 32px; }
.vdept-row .icon-btn .icon { transition: transform .15s; }
.vdept-row .icon-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
.vpeople { padding: 0 12px 8px 38px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 12px; }
.vpeople .check { font-size: 13px; }
.vcount { font-size: 12px; color: var(--muted); white-space: nowrap; }
.vcount.on { color: var(--green-fg); font-weight: 600; }
.dept-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.dept-add { display: flex; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dept-add input, .inline-form input, .type-add input[name=name], .type-edit input[name=name] {
  flex: 1 1 160px; min-width: 0; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); outline: none; }
.dept-add input:focus, .inline-form input:focus, .type-add input:focus, .type-edit input:focus { border-color: var(--text-2); box-shadow: 0 0 0 3px var(--focus-glow); }
.dlist { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.ditem { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 10px; color: var(--text); }
.ditem:hover { background: var(--surface-2); }
.ditem.on { background: var(--navy-bg); }
.ditem-name { font-weight: 650; }
.ditem.on .ditem-name { color: var(--navy-fg); }
.ditem-meta { font-size: 12px; color: var(--muted); }
.dept-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.dept-head h2 { font-size: 20px; font-weight: 700; }
.inline-form { display: flex; gap: 8px; flex: 1; max-width: 460px; }
.dept-actions { display: flex; gap: 6px; }
.type-list { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.type-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--border); }
.type-list li:last-child { border-bottom: 0; }
.tdot { --c: #9ca3af; width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex: 0 0 auto; }
.tname { font-weight: 600; flex: 1; min-width: 120px; }
.type-add, .type-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: 1; }
.type-add { margin-top: 12px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch { --c: #9ca3af; position: relative; width: 22px; height: 22px; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch i { display: block; width: 100%; height: 100%; border-radius: 6px; background: var(--c); }
.swatch:has(input:checked) i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatch:has(input:focus-visible) i { outline: 2px solid var(--ring); outline-offset: 4px; }

/* Notepad */
.greet-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.notepad-btn { color: var(--text-2); border: 1px solid var(--border); }
.notepad-btn .icon { color: var(--violet-fg); }
.modal-head h2 .icon { vertical-align: -3px; margin-right: 6px; color: var(--violet-fg); }
.notepad-body { display: flex; flex-direction: column; gap: 8px; }
.notepad-text { width: 100%; min-height: 340px; resize: vertical; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border-strong);
                background: var(--surface-2); color: var(--text); line-height: 1.6; font-size: 14.5px; outline: none; }
.notepad-text:focus { border-color: var(--text-2); box-shadow: 0 0 0 3px var(--focus-glow); background: var(--surface); }
.notepad-foot { display: flex; justify-content: space-between; gap: 12px; }

/* Meetings (violet, so they read apart from task deadlines) */
.meet-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.meet-head > p { flex: 1 1 240px; margin: 0; }
.meet-day { margin-bottom: 14px; }
.meet-day h3 { font-size: 13px; font-weight: 700; padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.meet-day h3 em { font-style: normal; font-size: 11.5px; font-weight: 700; margin-left: 6px; padding: 2px 8px; border-radius: 99px; background: var(--violet-bg); color: var(--violet-fg); }
.meet-day ul { list-style: none; margin: 0; padding: 0; }
.meet-day li + li { border-top: 1px solid var(--border); }
.meet-row { display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px 18px; border: 0; background: none; text-align: left; color: var(--text); }
.meet-row:hover { background: var(--surface-2); }
.meet-time { flex: 0 0 150px; font-weight: 700; font-size: 13px; color: var(--violet-fg); font-variant-numeric: tabular-nums; }
.meet-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.meet-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meet-people { display: inline-flex; align-items: center; flex: 0 0 auto; }
.meet-people .avatar { box-shadow: 0 0 0 2px var(--surface); }
.meet-people .avatar + .avatar { margin-left: -6px; }
.meet-people em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.meet-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 36px 20px; }
.meet-empty > .icon { width: 28px; height: 28px; color: var(--violet-fg); margin-bottom: 4px; }
.meet-desc { white-space: pre-wrap; word-break: break-word; }
.dmeet { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--violet-fg); min-width: 0; }
.dmeet i { width: 7px; height: 7px; border-radius: 2px; background: var(--violet-fg); flex: 0 0 auto; }
.dmeet span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ddots i.meet { border-radius: 2px; background: var(--violet-fg); }
.cal-legend i.meet { background: var(--violet-bg); border-color: var(--violet-fg); }
.side-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 8px; }
.side-add { margin-top: 12px; }
.meet-item { border: 1.5px solid color-mix(in srgb, var(--violet-fg) 45%, var(--border)); border-left: 5px solid var(--violet-fg); }

/* Project page: download photos and brochure (staff only) */
.proj-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.proj-downloads { display: flex; gap: 8px; flex-wrap: wrap; }
.dl-btn em { font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center;
             background: var(--surface-3); color: var(--text-2); }
.dl-btn.is-off { opacity: .5; cursor: not-allowed; box-shadow: none; }
.files-card .sub-h:first-of-type { margin-top: 4px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; }
.file-row .icon { color: var(--muted); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-pick { cursor: pointer; margin-right: 8px; }
.file-pick:has(input:disabled) { opacity: .5; pointer-events: none; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.dl-photo { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.dl-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.dl-photo figcaption { display: flex; align-items: center; gap: 4px; padding: 2px 2px 2px 8px; font-size: 11.5px; }
.dl-photo figcaption span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.dl-photo .icon-btn { width: 28px; height: 28px; }
.upload-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 600; color: var(--text-2); }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }

@media (max-width: 1280px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } .cal-side { position: static; } }
@media (max-width: 860px) { .dept-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .tasks-page .tab { padding: 10px 9px; gap: 6px; }
  .head-actions { width: 100%; }
  .head-actions > .btn { flex: 1 1 auto; }
  /* Columns side by side, swiped horizontally */
  .board { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin: 0 -16px; padding: 4px 16px 10px; scroll-padding: 0 16px; }
  .bcol { flex: 0 0 86%; scroll-snap-align: start; }
  .board-range { width: 100%; justify-content: space-between; }
  .cal-grid { gap: 4px; }
  .cday { min-height: 54px; padding: 5px; }
  .dtask, .dmore { display: none; }
  .ddots { display: flex; }
  .details { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .details dd { margin-bottom: 10px; }
  .task-filters .select-field, .task-export .select-field { flex: 1 1 calc(50% - 6px); }
  .people-filter { flex-basis: 100%; max-width: none; }
  .export-btns { width: 100%; }
  .export-btns .btn { flex: 1; }
  .vtree { margin-left: 0; }
  .vpeople { padding-left: 16px; }
  .meet-row { flex-wrap: wrap; gap: 4px 12px; padding: 12px 16px; }
  .meet-time { flex-basis: 100%; }
  .notepad-text { min-height: 55dvh; }
  .proj-downloads { width: 100%; }
  .proj-downloads .dl-btn { flex: 1; }
}

/* Project page: compact photo panel beside the key facts */
.proj-hero { display: grid; grid-template-columns: minmax(220px, 380px) minmax(0, 1fr); gap: 24px; padding: 18px; margin-bottom: 18px;
             background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.proj-media { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.proj-main { position: relative; display: block; width: 100%; height: 100%; min-height: 240px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--surface-3); cursor: zoom-in; }
.proj-main img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.proj-main:hover img { transform: scale(1.03); }
.proj-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.proj-thumbs button { position: relative; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--surface-3); cursor: zoom-in; }
.proj-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.proj-thumbs button span { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .5); color: #fff; font-weight: 700; }
.proj-noimg { display: grid; place-items: center; align-content: center; gap: 8px; height: 100%; min-height: 240px; border-radius: 12px; color: var(--faint);
              background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); font-size: 13px; }
.proj-noimg .icon { width: 40px; height: 40px; stroke-width: 1.5; }
.proj-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 4px 0; }
.proj-info h1 { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.proj-addr { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.proj-addr .icon { width: 15px; height: 15px; flex: 0 0 auto; }
.proj-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.pstat { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.pstat > .icon { width: 18px; height: 18px; color: var(--navy-fg); flex: 0 0 auto; margin-top: 1px; }
.pstat span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.pstat strong { display: block; font-size: 15px; margin-top: 2px; }
.pstat em { font-style: normal; color: var(--faint); font-weight: 500; }
.proj-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.proj-btns { display: flex; gap: 8px; }
.area-pick span .icon { width: 15px; height: 15px; }
.area-pick input:checked + span { border-color: var(--ring); background: var(--navy-bg); color: var(--navy-fg); }
@media (max-width: 1100px) {
  .proj-hero { grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); }
  .proj-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .proj-hero { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 14px; }
  .proj-main, .proj-noimg { height: auto; min-height: 0; aspect-ratio: 16 / 10; }
  .proj-info h1 { font-size: 22px; }
  .proj-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proj-actions, .proj-btns { width: 100%; }
  .proj-btns .btn { flex: 1; }
}

/* ---------- Login ---------- */
.login-body { background: radial-gradient(1200px 600px at 10% -10%, rgba(22, 43, 78, .16), transparent 60%), var(--bg); }
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 36px 32px 30px; box-shadow: var(--shadow-lg); }
.login-card .brand { padding: 0 0 28px; }
.login-card .brand-text strong { color: var(--text); font-size: 18px; }
.login-card .brand-text span { color: var(--muted); font-size: 13px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .lead { color: var(--muted); margin-bottom: 22px; }
.login-card .btn { width: 100%; height: 44px; margin-top: 6px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 18px 10px 12px; align-items: center; }
  .brand { padding: 4px 0 22px; }
  .brand-text, .nav-item span, .me-text { display: none; }
  .nav-item { justify-content: center; padding: 0; width: 48px; }
  .nav-item.active::before { left: -10px; }
  .me { background: none; padding: 4px; justify-content: center; }
  .chats { grid-template-columns: 320px minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  .editor-side { order: 2; }
  .unit-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .unit-row .icon-btn { justify-self: end; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 284px; transform: translateX(-100%); transition: transform .22s ease; align-items: stretch;
             padding: 18px 12px calc(12px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
  .nav-open .sidebar { transform: none; }
  .brand { padding: 4px 8px 22px; }
  .brand-text, .nav-item span, .me-text { display: flex; }
  .nav-item { justify-content: flex-start; padding: 0 12px; width: 100%; height: 46px; }
  .me { background: rgba(255, 255, 255, .04); padding: 8px; justify-content: flex-start; }
  .topbar { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px 0 6px; background: var(--side-bg); color: var(--side-strong); flex: 0 0 auto; }
  .topbar .icon-btn { color: var(--side-strong); }
  .topbar .icon-btn:hover { background: var(--side-hover); }
  .topbar-title { flex: 1; font-weight: 650; font-size: 16px; }
  .detail-open .topbar { display: none; }

  .page { padding: 20px 16px 40px; }
  .page-head h1 { font-size: 21px; }
  .card { padding: 18px 16px; border-radius: 14px; }
  .card-head.padded { padding: 18px 16px 0; }
  .toolbar.padded { padding: 14px 16px; }
  .toolbar .search-field { max-width: none; }
  .grid-2, .grid-3, .perm-grid { grid-template-columns: minmax(0, 1fr); }

  .chats { grid-template-columns: minmax(0, 1fr); }
  .chats.viewing .chat-list { display: none; }
  .chats:not(.viewing) .chat-pane { display: none; }
  .chat-head { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .chat-head .back { display: inline-grid; }
  .messages { padding: 14px 12px; }
  .bubble { max-width: 86%; }
  .lead-strip { padding: 10px 14px; }
  .lead-strip .grow { display: none; }
  .lead-strip .btn { margin-left: auto; }
  .chat-actions .btn span { display: none; }
  .bot-toggle-label > span { display: none; }
  .chat-actions .btn { width: 38px; padding: 0; }

  .stats { gap: 10px; }
  .stat { padding: 12px; gap: 10px; min-height: 0; border-radius: 14px; }
  .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
  .stat-value { font-size: 19px; }
  .stat-label { font-size: 12px; }
  .stat-label .muted { display: none; }
  .filters { padding: 14px 16px; }
  .filter-main .search-field { max-width: none; }
  .filter-toggle { display: inline-flex; }
  .filters:not(.open) .filter-more { display: none; }
  .select-field { max-width: none; flex: 1 1 calc(50% - 5px); min-width: 0; }
  .lead-table { display: none; }
  .lead-cards { display: block; }
  .pager { padding: 12px 16px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  dialog.drawer { width: 100vw; }
  .list-toolbar .search-field { min-width: 0; flex-basis: 100%; }
  .seg-tabs { width: 100%; }
  .seg-tabs button { flex: 1; }
  .project-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
          .unit-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .unit-row .field:first-child { grid-column: span 2; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head .page-actions .btn { flex: 1; }
  .kv { grid-template-columns: 18px 96px minmax(0, 1fr); }

  /* Tables become stacked cards */
  .table.users thead, .table.stack thead { display: none; }
  .table.users, .table.users tbody, .table.users tr, .table.users td,
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.users tr, .table.stack tr { padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .table.users td, .table.stack td { border: 0; padding: 4px 0; }
  .table.users td[data-label]:not([data-label="User"])::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin-bottom: 2px; }
  .table.users td.actions { text-align: left; padding-top: 10px; }

  dialog.modal, dialog.modal.wide, dialog.modal.xwide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  dialog.modal.small { width: calc(100vw - 32px); height: auto; border-radius: var(--radius-lg); margin: auto; }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .toasts { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
}
/* CRM: the filter panel slides over the table on smaller screens */
@media (max-width: 900px) {
  .crm-layout, .crm-layout.panel-collapsed { grid-template-columns: minmax(0, 1fr); }
  .crm-filters { position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); z-index: 45; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); visibility: visible !important; }
  .crm-layout.panel-open .crm-filters { transform: none; }
  .crm-scrim { z-index: 44; }
  .crm-fclose { display: inline-grid; }
}
@media (max-width: 760px) {
  .crm-head { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 0; }
  .crm-title h1 { font-size: 20px; }
  .crm-head-right { order: 2; }
  .crm-stat { flex: 1; align-items: flex-start; min-width: 0; }
  .crm-tabs { order: 3; }
  .crm-toolbar { padding: 12px 16px; flex-wrap: wrap; }
  .crm-toolbar .search-field { max-width: none; flex-basis: 100%; }
  .crm-tools { margin-left: 0; width: 100%; }
  .crm-tools .btn { flex: 1; }
  .crm-table-wrap { margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .crm-table { display: none; }
  .crm-cards { display: block; }
  .crm-pager { margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .crm-pager .pager-controls label { display: none; }
  .crm-change-tools .seg-tabs { width: 100%; }
  .select-field.inline { max-width: none; width: 100%; }
  .matrix { margin: 0 8px 12px; }
  .matrix td { min-width: 52px; }
  .changes-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin-bottom: 2px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* Google Drive project library */
/* Project files: 8 square tiles per row, two rows visible, the rest scrolls. */
.drive-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drive-tabs, .drive-add, .drive-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.drive-tabs .btn[aria-pressed="true"], .drive-tabs .btn[aria-pressed="true"]:hover { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.drive-body { container-type: inline-size; }
.drive-grid { --cols: 8; --gap: 8px; --tile: calc((100cqi - (var(--cols) - 1) * var(--gap)) / var(--cols));
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: var(--tile); gap: var(--gap);
  max-height: calc(2 * var(--tile) + var(--gap)); overflow-y: auto; overscroll-behavior: contain; }
@container (max-width: 560px) { .drive-grid { --cols: 4; } }
.drive-tile { position: relative; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted); cursor: pointer; overflow: hidden; }
.drive-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.drive-tile:hover img { transform: scale(1.04); }
.drive-tile:focus-visible { outline: 2px solid var(--brand-tint); outline-offset: 2px; }
.drive-tile-icon { display: grid; justify-items: center; gap: 4px; font-size: 12px; }
.drive-tile-name { position: absolute; inset: auto 0 0; padding: 14px 6px 5px; font-size: 11px; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .15s; }
.drive-tile:hover .drive-tile-name, .drive-tile:focus-visible .drive-tile-name { opacity: 1; }
.drive-empty { padding: 18px 0; }
.drive-preview { width: min(1100px, 94vw); max-height: 94vh; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); }
.drive-preview::backdrop { background: rgba(0, 0, 0, .8); }
.drive-preview-head { display: flex; gap: 12px; align-items: center; }
.drive-preview-head strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.drive-preview-stage { position: relative; display: grid; place-items: center; min-height: 240px; margin: 10px 0; }
.drive-preview-media { width: 100%; text-align: center; }
.drive-preview-media img, .drive-preview-media video { max-width: 100%; max-height: 68vh; border-radius: var(--radius-sm); }
.drive-preview-media iframe { width: 100%; height: 68vh; border: 0; }
.drive-preview-note { padding: 40px 56px; color: var(--muted); }
.drive-nav { position: absolute; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; z-index: 1; }
.drive-nav:hover { background: rgba(0, 0, 0, .75); }
.drive-nav .icon { width: 22px; height: 22px; }
.drive-nav.prev { left: 8px; }
.drive-nav.next { right: 8px; }
.drive-preview-footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; min-height: 38px; }
.drive-rename { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.drive-rename input { flex: 1; min-width: 160px; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.drive-confirm { display: flex; gap: 8px; align-items: center; margin: 0; overflow-wrap: anywhere; }
.drive-confirm .icon { color: var(--danger); flex: none; }

/* ---------- Project files: bulk delete ---------- */
.drive-select { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.drive-select:empty { display: none; }
.drive-select strong { margin-right: 4px; }
.drive-check { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, .35); color: transparent; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.drive-check .icon { width: 14px; height: 14px; stroke-width: 3; }
.drive-grid.selecting .drive-tile:hover img { transform: none; }
.drive-tile.selected { border-color: var(--danger); box-shadow: inset 0 0 0 2px var(--danger); }
.drive-tile.selected img { opacity: .75; }
.drive-tile.selected .drive-check { background: var(--danger); color: #fff; }
.tab-short, .filters-toggle { display: none; }

/* ---------- Task Manager & Projects on phones ---------- */
@media (max-width: 760px) {
  /* Tabs: four equal columns, icon above a short label, Notifications as a compact bell */
  .tasks-page .tabs-row { gap: 8px; }
  .tasks-page .tabs-row .tabs { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .tasks-page .tabs-row .tab { flex-direction: column; justify-content: center; gap: 3px; padding: 8px 2px 7px; font-size: 12px; }
  .tasks-page .tabs-row .tab .icon { width: 18px; height: 18px; }
  .tab-long { display: none; }
  .tab-short { display: inline; }
  .notify-btn { height: 40px; padding: 0 10px; gap: 6px; }

  /* All Tasks: People + Search always, the rest behind "Filters" */
  .task-filters { padding: 14px 16px; }
  .task-filters .people-filter { order: 1; }
  .task-filters .select-field.grow { order: 2; flex-basis: 100%; }
  .task-filters .filters-toggle { order: 3; display: inline-flex; flex: 1 1 100%; }
  .task-filters .more-filter { order: 4; }
  .task-filters [data-clear] { order: 5; }
  .task-filters:not(.open) .more-filter { display: none; }
  .filters-toggle .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
    background: var(--brand); color: var(--brand-ink); font-size: 11px; }

  /* Task tables (All Tasks, Assigned by me) and Apartment types become cards */
  .task-table, .units-table { min-width: 0; }
  .task-table thead, .units-table thead { display: none; }
  .task-table, .task-table tbody, .units-table, .units-table tbody { display: block; width: 100%; }
  .task-table tr, .units-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .task-table tr { box-shadow: inset 4px 0 0 var(--p, transparent); padding-left: 20px; }
  .units-table tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-table td, .units-table td { display: block; min-width: 0; max-width: none; padding: 0; border: 0; white-space: normal; }
  .task-table tbody td:first-child { box-shadow: none; }
  .task-table td.ttitle { grid-column: 1 / -1; order: -1; font-size: 15px; }
  .units-table td:first-child { grid-column: 1 / -1; font-size: 15px; }
  .task-table td[colspan], .units-table td[colspan] { grid-column: 1 / -1; }
  .task-table td[data-label]::before, .units-table td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }

  /* Project files header: icon-only Refresh */
  .drive-card .card-head { flex-wrap: nowrap; }
  .drive-card .card-head .btn-text { display: none; }
  .drive-card .card-head [data-drive-refresh] { width: 36px; padding: 0; flex: none; }
  .drive-bar { align-items: stretch; }
  .drive-add { width: 100%; justify-content: space-between; }

  /* Edit project: Save / Cancel stay on screen */
  .page.editor-page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .editor-page .editor-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(0, 0, 0, .08); }
}
