/* ─────────────────────────────────────────
   CLIENT HUB  —  style.css
   ClickUp-inspired SaaS theme
───────────────────────────────────────── */

/* ── RESET & TOKENS ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Backgrounds */
  --bg: #12111a;
  /* main content bg */
  --bg2: #0e0d14;
  /* sidebar bg */
  --bg3: #1a1827;
  /* card / surface bg */

  /* Surfaces */
  --surface: rgba(255, 255, 255, 0.04);
  --surface2: rgba(255, 255, 255, 0.07);

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.13);

  /* Accent — ClickUp violet */
  --accent: #7C3AED;
  --accent2: #A78BFA;
  --accent-bg: rgba(124, 58, 237, 0.14);

  /* Semantic colours */
  --success: #22C55E;
  --danger: #EF4444;
  --warning: #F59E0B;

  /* Text */
  --text: #E9E9F3;
  --text2: #9091A8;
  --text3: #5E5F78;

  /* Layout */
  --top-nav-h: 52px;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  --trans: .15s ease;
}

html {
  font-size: 15px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 5px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

/* ── TOP NAV BAR ── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-nav-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 200;
  backdrop-filter: blur(12px);
  overflow: visible;
}

.top-nav-left, .top-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Center section: absolutely centered in the nav bar */
.top-nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
}

/* Tab title pill */
.tab-title-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 8px 18px 8px 20px;
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans);
  white-space: nowrap;
  letter-spacing: -.1px;
}
.tab-title-btn:hover { background: rgba(255,255,255,.13); border-color: var(--border2); }
.tab-title-chevron {
  font-size: .7rem;
  opacity: .55;
  margin-left: 2px;
  transition: transform .22s cubic-bezier(.4,0,.2,1), opacity .15s;
}
.tab-title-btn.nav-open .tab-title-chevron {
  transform: rotate(180deg);
  opacity: .8;
}

.top-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--trans);
}
.top-nav-logo:hover { background: rgba(255,255,255,.06); }

.logo-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.6rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: .06em;
  line-height: 1;
  align-self: center;
  transform: translateY(5px);
}

/* ── NAV MEGA-MENU DROPDOWN ── */
.nav-dropdown {
  position: fixed;
  top: calc(var(--top-nav-h) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  width: 540px;
  background: rgba(18, 16, 30, 0.97);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 20px;
  box-shadow:
    0 24px 64px rgba(0,0,0,.75),
    0 2px 0 rgba(139,92,246,.12) inset,
    0 0 0 1px rgba(255,255,255,.04) inset;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  z-index: 300;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s cubic-bezier(.4,0,.2,1), visibility 0s linear .18s;
}
.nav-dropdown.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity .18s ease, transform .18s cubic-bezier(.4,0,.2,1);
}

/* 3-column grid */
.nav-mega-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: start;
  gap: 0;
}
.nav-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 4px;
}
.nav-col-divider {
  width: 1px;
  align-self: stretch;
  background: linear-gradient(to bottom, transparent, rgba(139,92,246,.18) 20%, rgba(139,92,246,.18) 80%, transparent);
  margin: 2px 10px;
}

/* Nav items */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgba(255,255,255,.58);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  padding: 9px 12px;
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s, transform .1s;
  text-align: left;
  width: 100%;
  position: relative;
  white-space: nowrap;
}
.nav-btn:hover {
  background: rgba(139,92,246,.10);
  border-color: rgba(139,92,246,.16);
  color: rgba(255,255,255,.92);
  transform: translateX(2px);
}
.nav-btn.active {
  background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(99,66,204,.10));
  border-color: rgba(139,92,246,.32);
  color: var(--accent2);
  font-weight: 600;
  transform: none;
}
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 2px;
  background: var(--accent2);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent2);
}

.nav-icon {
  font-size: .88rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: transform .13s;
}
.nav-btn:hover .nav-icon { transform: scale(1.12); }
.nav-btn.active .nav-icon { opacity: 1; }

/* Footer */
.nav-dropdown-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 6px;
}

#client-count-pill {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text3);
  padding: 0 12px;
}

/* Nav badge (notifications count on nav item) */
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── TECH PORTALS VIEW ── */
.portal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 10px;
  gap: 12px;
}

.portal-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.portal-card-name {
  font-size: .95rem;
  font-weight: 600;
}

.portal-card-meta {
  font-size: .8rem;
  color: var(--text2);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-pin-ok {
  color: var(--success);
  font-size: .74rem;
}

.portal-pin-warn {
  color: var(--danger);
  font-size: .74rem;
}

/* ── NOTIFICATIONS VIEW ── */
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg3);
  transition: background var(--trans);
}

.notif-row.notif-unread {
  background: rgba(124, 58, 237, .05);
  border-color: var(--border2);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent2);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: .875rem;
  line-height: 1.5;
}

.notif-meta {
  font-size: .78rem;
  color: var(--text2);
  margin-top: 4px;
}

.notif-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}

.btn-sm {
  padding: 5px 10px;
  font-size: .78rem;
}

.notif-badge-approved {
  background: rgba(34, 197, 94, .12);
  color: var(--success);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .78rem;
  font-weight: 600;
}

.notif-badge-declined {
  background: rgba(239, 68, 68, .1);
  color: var(--danger);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .78rem;
  font-weight: 600;
}

.notif-badge-tasked {
  background: rgba(124, 58, 237, .1);
  color: var(--accent2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .78rem;
  font-weight: 600;
}

/* ── TASKS VIEW ── */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg3);
  transition: opacity var(--trans);
}

.task-row.task-done {
  opacity: .5;
}

.task-check {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-title {
  font-size: .875rem;
  font-weight: 500;
}

.task-meta {
  font-size: .74rem;
  color: var(--text2);
}

.task-row.task-done .task-title {
  text-decoration: line-through;
}

/* ── MAIN CONTENT ── */
.main-content {
  padding: calc(var(--top-nav-h) + 16px) 40px 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ── NOTIFICATIONS BELL ── */
.notif-bell-btn {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: background .18s, transform .15s;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
  margin-left: auto;
}
.notif-bell-btn:hover {
  background: var(--surface2, #1e1b2e);
  transform: scale(1.08);
}
.notif-bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  border: 1.5px solid var(--bg, #0e0d14);
}

/* ── User Avatar Menu ─────────────────────────── */
.user-avatar-wrap { position: relative; }
.user-avatar-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 800; color: #fff;
  letter-spacing: .03em; text-transform: uppercase;
  transition: transform .15s, box-shadow .18s;
  box-shadow: 0 2px 12px rgba(139,92,246,.3);
}
.user-avatar-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(139,92,246,.45);
}
.user-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  min-width: 220px; z-index: 999;
  background: rgba(22,20,35,.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
  padding: 6px;
  animation: userMenuIn .18s ease;
}
@keyframes userMenuIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.user-menu-info {
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 4px;
}
.user-menu-info-name {
  font-size: .82rem; font-weight: 700; color: var(--text);
}
.user-menu-info-email {
  font-size: .68rem; color: var(--text2); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-menu-info-role {
  font-size: .62rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .08em; margin-top: 4px;
}
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: .82rem; font-weight: 500;
  border-radius: 10px; transition: background .12s;
  text-align: left;
}
.user-menu-item:hover { background: rgba(255,255,255,.06); }
.user-menu-signout { color: #f87171; }
.user-menu-signout:hover { background: rgba(248,113,113,.08); }
.user-menu-divider {
  height: 1px; background: rgba(255,255,255,.06);
  margin: 4px 8px;
}

/* ── VIEWS ── */
.view {
  display: none;
  animation: fadeUp .2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes chipCtxFadeIn {
  from { opacity: 0; transform: scale(.95) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--text);
}

/* Hide subtitle on weekly view to save space */
#view-weekly .subtitle { display: none; }

.subtitle {
  color: var(--text2);
  margin-top: 4px;
  font-size: .88rem;
}
/* ── HOME WIDGETS (Tasks + Replacements) ── */
.home-widgets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.home-widget {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 18px;
}
.home-widget::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: .6;
}
.home-widget:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(139,92,246,.2);
  border-color: var(--accent);
}
.home-widget:hover::before { opacity: 1; }
.home-widget-icon {
  font-size: 3.2rem;
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139,92,246,.1);
  border-radius: 16px;
  transition: background .2s, transform .2s;
}
.home-widget:hover .home-widget-icon {
  background: rgba(139,92,246,.2);
  transform: scale(1.06);
}
.home-widget-body { flex: 1; min-width: 0; }
.home-widget-title { font-size: 1.1rem; font-weight: 800; color: var(--text); display: block; margin-bottom: 10px; }
.home-widget-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 14px;
}
.hw-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 6px; background: rgba(255,255,255,.04);
  border-radius: 10px; border: 1px solid rgba(255,255,255,.06);
}
.hw-stat-val { font-size: 1.4rem; font-weight: 800; line-height: 1.2; }
.hw-stat-lbl { font-size: .65rem; color: var(--text2); font-weight: 600; margin-top: 2px; text-align: center; }

@media (max-width: 640px) {
  .home-widgets { grid-template-columns: 1fr; }
  .home-widget-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Chat Widget ─────────────────────────────── */
.hw-chat-widget { cursor: pointer; }
.hw-chat-threads {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 10px; min-height: 60px;
}
.hw-chat-empty {
  color: var(--text2); font-size: .82rem; padding: 14px 0;
  text-align: center;
}
.hw-chat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,.03);
  transition: background .15s;
}
.hw-chat-row:hover { background: rgba(255,255,255,.07); }
.hw-chat-avatar-wrap { position: relative; flex-shrink: 0; }
.hw-chat-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 800; letter-spacing: .03em;
}
.hw-chat-dot {
  position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--bg3);
}
.hw-chat-dot.online { background: #22c55e; }
.hw-chat-dot.offline { background: #64748b; }
.hw-chat-info { flex: 1; min-width: 0; }
.hw-chat-name {
  font-size: .78rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hw-chat-preview {
  font-size: .7rem; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hw-chat-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 3px; flex-shrink: 0;
}
.hw-chat-time {
  font-size: .62rem; color: var(--text2); white-space: nowrap;
}
.hw-chat-badge {
  background: var(--accent); color: #fff;
  font-size: .6rem; font-weight: 800;
  padding: 1px 6px; border-radius: 10px; min-width: 16px;
  text-align: center; line-height: 1.3;
}
.hw-chat-unread-badge {
  background: var(--accent); color: #fff;
  font-size: .65rem; font-weight: 800;
  padding: 2px 7px; border-radius: 10px;
  margin-left: auto;
}

/* ── HOME CARDS ── */
.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.home-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.home-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 1;
  transition: opacity var(--trans);
}

.home-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .4);
  border-color: var(--border2);
}

.home-card:hover::before {
  opacity: 1;
}

.home-card-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139,92,246,.08);
  border-radius: 14px;
  transition: background .2s, transform .2s;
}
.home-card:hover .home-card-icon {
  background: rgba(139,92,246,.15);
  transform: scale(1.05);
}

.home-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.home-card-body { flex: 1; min-width: 0; }

.home-card p {
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.55;
  margin-bottom: 14px;
}

.home-card-cta {
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent2);
}

/* ── HOME STATS ── */
.home-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stat-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  flex: 1;
  min-width: 130px;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.stat-chip[onclick]:hover {
  border-color: var(--accent2);
  box-shadow: 0 0 12px rgba(139,92,246,.25);
}

.stat-chip .stat-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent2);
  display: block;
  letter-spacing: -.5px;
}

.stat-chip .stat-label {
  font-size: .72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
  margin-top: 4px;
}

/* ── CARD ── */
.glass-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.glass-card h3 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

/* ── SEARCH BAR ── */
.search-bar-wrap {
  margin-bottom: 14px;
}

.search-bar-wrap input {
  width: 100%;
  max-width: 360px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .875rem;
  padding: 9px 14px;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.search-bar-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

/* ── TABLE ── */
.table-wrap {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  /* horizontal scroll when table is wider than viewport */
  overflow-y: hidden;
}

.data-table {
  width: 100%;
  min-width: 1100px;
  /* prevent squishing; wrapper scrolls instead */
  border-collapse: collapse;
  table-layout: fixed;
  /* enables resize: horizontal on th */
  font-size: .855rem;
}

.data-table thead {
  background: rgba(124, 58, 237, .08);
  border-bottom: 1px solid var(--border2);
}

.data-table th {
  text-align: left;
  padding: 11px 16px;
  font-weight: 600;
  color: var(--text2);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  resize: horizontal;
  /* drag right edge to resize column */
  position: relative;
}

.data-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--text);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.data-table tbody tr.row-selected {
  background: rgba(124, 58, 237, .08);
  border-left: 2px solid var(--accent);
}

/* ── Group rows ── */
.group-row {
  background: rgba(124, 58, 237, .05);
  border-left: 3px solid var(--accent);
  transition: background .15s;
}

.group-row:hover {
  background: rgba(124, 58, 237, .12);
}

.group-row-highlighted {
  background: rgba(124, 58, 237, .14);
  outline: 1px solid var(--accent);
}

/* ── P&L boxes ── */
.pnl-box {
  flex: 1;
  min-width: 160px;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid transparent;
}

.pnl-income {
  background: rgba(34, 197, 94, .08);
  border-color: rgba(34, 197, 94, .2);
}

.pnl-cost {
  background: rgba(239, 68, 68, .08);
  border-color: rgba(239, 68, 68, .2);
}

.pnl-net {
  background: rgba(34, 197, 94, .08);
  border-color: rgba(34, 197, 94, .2);
}

.pnl-val {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.5px;
}

.pnl-income .pnl-val,
.pnl-net .pnl-val { color: #22c55e; }

.pnl-cost .pnl-val { color: #ef4444; }

.pnl-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
}

.col-actions {
  width: 120px;
  text-align: right;
}

.data-table td:last-child {
  text-align: right;
}

/* ── Sortable column headers ── */
.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  color: var(--text);
}

.sortable::after {
  content: '';
  display: inline-block;
  width: 14px;
  opacity: .35;
  font-size: .7rem;
}

.sortable.sort-asc::after {
  content: ' ▲';
  opacity: 1;
  color: var(--accent2);
}

.sortable.sort-desc::after {
  content: ' ▼';
  opacity: 1;
  color: var(--accent2);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: .855rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
  letter-spacing: -.1px;
}

/* ClickUp primary: solid vivid violet, no gradient */
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(124, 58, 237, .35);
}

.btn-primary:hover {
  background: #6d28d9;
  box-shadow: 0 4px 16px rgba(124, 58, 237, .45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent2);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

.btn-danger {
  background: rgba(239, 68, 68, .1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, .22);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, .18);
}

.btn-icon {
  padding: 6px 9px;
  font-size: .8rem;
}

/* ── FORM GRID ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-group input,
.form-group select {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .875rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

.form-group select option {
  background: var(--bg2);
}

.form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.form-row input {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .875rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.form-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

/* ── MODAL ── */
/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  animation: fadeUp .18s ease;
}

.modal-box {
  background: #1e1b2e;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius, 12px);
  box-shadow: 0 24px 64px rgba(0,0,0,.7);
  animation: fadeUp .18s ease;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 1.1rem;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans);
}

.modal-close:hover {
  background: var(--surface2);
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

/* ── P&L strip inside client modal ── */
.pnl-strip {
  display: flex;
  gap: 12px;
  margin: 16px 0 0;
}

.pnl-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
}

.pnl-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
}

.pnl-value {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.3px;
}

.pnl-income  .pnl-value { color: #4ade80; }
.pnl-cost    .pnl-value { color: #f87171; }
.pnl-profit  .pnl-value { color: #4ade80; }
.pnl-profit.pnl-profit-negative .pnl-value { color: #f87171; }

.pnl-income  { border-left: 3px solid #4ade80; }
.pnl-cost    { border-left: 3px solid #f87171; }
.pnl-profit  { border-left: 3px solid #4ade80; }
.pnl-profit.pnl-profit-negative { border-left-color: #f87171; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── Weekly tech tabs (jump-to-column shortcuts) ── */
.weekly-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px 5px 8px;
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.weekly-tab:hover {
  background: rgba(124,58,237,.1);
  border-color: var(--accent);
  color: var(--text);
}
.weekly-tab-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.weekly-tab-meta {
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: .7rem;
  font-weight: 500;
  color: var(--text2);
}

/* ── KANBAN BOARD ── */
/* Only flex when this view is actually active */
#view-weekly.active {
  display: flex;
  flex-direction: column;
}
#view-weekly {
  height: calc(100vh - var(--top-nav-h));
  overflow-y: clip;
  overflow-x: visible;
}

/* Middle-mouse drag: cursor hint */
#kanban-scroll-wrapper.mm-dragging {
  cursor: grabbing !important;
  user-select: none;
}

#weekly-content {
  height: 100%;
}

#kanban-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-height: 180px;
  width: 100vw;
  margin-left: -40px;
  padding-left: 40px;
}

.kanban-board {
  display: flex;
  gap: 14px;
  align-items: stretch;
  height: 100%;
  padding-right: 200px;
}

/* Per-column scrollable body */
.kanban-col-body {
  flex: 1;
  overflow-y: scroll;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.kanban-col-body::-webkit-scrollbar {
  width: 4px;
}
.kanban-col-body::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.kanban-col {
  flex-shrink: 0;
  width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.kanban-col-unassigned {
  opacity: .75;
  border-style: dashed;
}

.kanban-col-header[draggable="true"] {
  cursor: grab;
}
.kanban-col-header[draggable="true"]:active {
  cursor: grabbing;
}

.kanban-col.col-drop-left  { border-left:  3px solid var(--accent); }
.kanban-col.col-drop-right { border-right: 3px solid var(--accent); }

.kanban-col-header {
  background: linear-gradient(135deg, rgba(108, 99, 255, .2), rgba(167, 139, 250, .1));
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.kanban-col-unassigned .kanban-col-header {
  background: rgba(255, 255, 255, .04);
}

.kanban-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.kanban-col-unassigned .kanban-avatar {
  background: var(--surface2);
  color: var(--text2);
}

.kanban-col-name {
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-col-sub {
  font-size: .7rem;
  color: var(--text2);
  margin-top: 2px;
}

/* ── Day lanes ── */
.kanban-lane {
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
  cursor: default;
}

.kanban-lane:last-child {
  border-bottom: none;
}

.kanban-lane.drag-over {
  background: rgba(108, 99, 255, .18);
}

.kanban-lane-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text2);
  padding: 7px 10px 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-lane-hrs {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.08);
  padding: 1px 6px;
  border-radius: 10px;
  opacity: .85;
}

.kanban-lane.drag-over .kanban-lane-label {
  color: var(--accent2);
}

.kanban-lane-cards {
  padding: 3px 8px 8px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ── Cards ── */
.kanban-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  user-select: none;
  transition: border-color var(--trans), box-shadow var(--trans), opacity var(--trans), transform var(--trans);
  gap: 6px;
  position: relative;
}

.kanban-card.drag-above {
  border-top: 2px solid var(--accent);
}

.kanban-card.drag-below {
  border-bottom: 2px solid var(--accent);
}

.kanban-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(108, 99, 255, .25);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: .3;
  cursor: grabbing;
  transform: scale(.97);
}

.kanban-card-name {
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.kanban-card-hrs {
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent2);
  flex-shrink: 0;
  background: rgba(167, 139, 250, .12);
  padding: 2px 6px;
  border-radius: 99px;
}

/* ── Drop hint ── */
.kanban-drop-hint {
  font-size: .7rem;
  color: var(--text2);
  opacity: 0;
  text-align: center;
  padding: 2px 0;
  transition: opacity var(--trans);
  pointer-events: none;
}

.kanban-lane.drag-over .kanban-drop-hint {
  opacity: .7;
  color: var(--accent2);
}

/* ── MAP ── */
.map-controls {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: flex-end;
}

.map-search-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 240px;
}

.map-search-group label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.map-search-inner {
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

.map-search-inner input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--trans);
}

.map-search-inner input:focus {
  border-color: var(--accent);
}

.map-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  z-index: 1000;
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow-y: auto;
}

.map-suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: .9rem;
  transition: background var(--trans);
}

.map-suggestion-item:hover {
  background: var(--surface2);
  color: var(--accent2);
}

#map-container {
  width: 100%;
  height: 680px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.map-note {
  font-size: .8rem;
  color: var(--text2);
  margin-top: 8px;
}


/* ── UNIFIED TEAM PAGE ─────────────────────── */
.tuc-add-form {
  padding: 14px 18px;
  margin-bottom: 18px;
}
.tuc-add-form .form-row {
  gap: 10px;
}

.tuc-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: background var(--trans), border-color var(--trans);
}
.tuc-card:hover {
  background: rgba(255,255,255,.03);
  border-color: rgba(255,255,255,.1);
}
.tuc-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.tuc-avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.tuc-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.tuc-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tuc-meta {
  font-size: .78rem;
  color: var(--text2);
}
.tuc-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.tuc-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .2px;
}
.tuc-badge--login  { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.25); }
.tuc-badge--nologin{ background: rgba(255,255,255,.05); color: #8b89a8; border: 1px solid rgba(255,255,255,.1); }
.tuc-badge--pin    { background: rgba(124,58,237,.15); color: #c4b5fd; border: 1px solid rgba(124,58,237,.25); }
.tuc-badge--nopin  { background: rgba(251,191,36,.1); color: #fbbf24; border: 1px solid rgba(251,191,36,.25); }

.tuc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── (keep old tech-card for any legacy references) ── */
.tech-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin-bottom: 10px;
  transition: background var(--trans);
}
.tech-card:hover {
  background: rgba(255, 255, 255, 0.03);
}


.tech-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  margin-right: 12px;
  flex-shrink: 0;
}

.tech-info {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

/* Clickable name button */
.tech-name-btn {
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: color var(--trans);
  display: block;
}

.tech-name-btn:hover {
  color: var(--accent2);
  text-decoration: underline;
}

.tech-meta {
  font-size: .78rem;
  color: var(--text2);
  margin-top: 2px;
}

/* ── TECH PROFILE MODAL ── */
.tech-modal-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Stats grid — 3 columns */
.tp-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tp-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tp-stat-profit {
  grid-column: 1 / -1;
  /* spans all 3 columns */
  background: rgba(124, 58, 237, .06);
  border-color: var(--border2);
}

.tp-stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.tp-stat-label {
  font-size: .72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text2);
}

/* Accounts list (collapsible) */
.tp-account-details {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.tp-account-list-inner {
  max-height: 180px;
  overflow-y: auto;
}

/* Tech modal body scroll */
#tech-modal .modal-body {
  max-height: 65vh;
  overflow-y: auto;
}

.tp-account-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
  padding: 7px 12px;
  background: rgba(124, 58, 237, .07);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.tp-account-label::-webkit-details-marker { display: none; }
.tp-account-label::before { content: '▸ '; }
details[open] > .tp-account-label::before { content: '▾ '; }

.tp-account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  font-size: .855rem;
  border-bottom: 1px solid var(--border);
}

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

.tp-account-inv {
  font-size: .78rem;
  color: var(--accent2);
  font-weight: 600;
  white-space: nowrap;
}

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .74rem;
  font-weight: 600;
}

.badge-day {
  background: rgba(167, 139, 250, .15);
  color: var(--accent2);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  color: var(--text2);
  padding: 48px 20px;
  font-size: .9rem;
}

/* ── TOAST (queue-based stacking) ── */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  max-width: 360px;
}

.toast {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 20px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  opacity: 0;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  pointer-events: auto;
  max-width: 340px;
  position: relative;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.hide {
  transform: translateY(-8px);
  opacity: 0;
}

.toast.success {
  border-color: var(--success);
  color: var(--success);
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

.toast.info {
  border-color: var(--accent);
  color: var(--accent2);
}

/* ── SKELETON SHIMMER ── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.03) 25%,
    rgba(255,255,255,.08) 50%,
    rgba(255,255,255,.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.short { width: 45%; }
.skeleton-text.medium { width: 70%; }
.skeleton-text.long { width: 90%; }

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-card {
  height: 72px;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.skeleton-stat {
  height: 80px;
  border-radius: var(--radius);
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

/* Portal-specific skeleton for Kanban cards */
.skeleton-kanban-card {
  height: 56px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

/* ── ADDRESS AUTOCOMPLETE ── */
.address-autocomplete-wrap {
  position: relative;
}

.address-autocomplete-wrap input {
  width: 100%;
}

.address-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
  z-index: 500;
  max-height: 220px;
  overflow-y: auto;
}

.addr-suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: .88rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background var(--trans), color var(--trans);
  line-height: 1.35;
}

.addr-suggestion-item:last-child {
  border-bottom: none;
}

.addr-suggestion-item:hover,
.addr-suggestion-item.active {
  background: linear-gradient(135deg, rgba(108, 99, 255, .2), rgba(167, 139, 250, .1));
  color: var(--accent2);
}

/* ── MODAL TABS ── */
.modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, .15);
}

.modal-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text2);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  padding: 13px 20px;
  cursor: pointer;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
}

.modal-tab:hover {
  color: var(--text);
  background: var(--surface2);
}

.modal-tab.active {
  color: var(--accent2);
  border-bottom-color: var(--accent);
  background: rgba(108, 99, 255, .06);
}

/* ── NOTES FORM (inside modal) ── */
.notes-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  min-height: 120px;
  transition: border-color var(--trans);
  line-height: 1.6;
}

.form-group textarea:focus {
  border-color: var(--accent);
}

/* ── IMAGE UPLOAD AREA ── */
.image-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  cursor: pointer;
  color: var(--text2);
  font-size: .88rem;
  transition: border-color var(--trans), background var(--trans);
}

.image-upload-area:hover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, .07);
  color: var(--accent2);
}

.upload-icon {
  font-size: 1.8rem;
}

.upload-hint {
  font-size: .76rem;
  opacity: .6;
}

/* ── IMAGE PREVIEW GRID ── */
.image-preview-grid,
.notes-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.img-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
}

.img-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--trans);
}

.img-thumb-wrap:hover .img-thumb {
  transform: scale(1.06);
}

.img-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: .7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--trans);
  z-index: 2;
}

.img-thumb-wrap:hover .img-thumb-remove {
  opacity: 1;
}

/* ── NOTES PANEL (below table, in Clients view) ── */
.notes-panel {
  margin-top: 20px;
  animation: fadeUp .2s ease;
}

.notes-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.notes-panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0;
}

.notes-panel-body {
  font-size: .9rem;
  line-height: 1.7;
}

.notes-text-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  white-space: pre-wrap;
  color: var(--text);
}

.notes-empty {
  color: var(--text2);
  font-size: .9rem;
  margin-bottom: 14px;
}

/* ── NOTES BADGE (in table) ── */
.notes-badge {
  color: var(--accent2) !important;
  opacity: 1 !important;
  font-size: .8rem;
}

/* ── LIGHTBOX ── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  padding: 24px;
  animation: fadeUp .15s ease;
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 48px rgba(0, 0, 0, .7);
  object-fit: contain;
}

.lightbox-caption {
  color: var(--text2);
  font-size: .82rem;
}

/* ═══════════════════════════════════════════
   ROUTE PLANNER (TEST MODE)
═══════════════════════════════════════════ */
#test-planner-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
.tp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
  gap: 16px;
}

.tp-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text2);
}

.tp-badge {
  background: rgba(255, 20, 147, .15);
  color: #FF1493;
  border: 1px solid rgba(255, 20, 147, .3);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .8px;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.tp-close {
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .25);
  color: var(--danger);
  font-size: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans);
  flex-shrink: 0;
}

.tp-close:hover {
  background: rgba(239, 68, 68, .22);
}

/* ── Body ── */
.tp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top section — fills entire body */
.tp-top-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg2);
}


/* ── Section labels ── */
.tp-section-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text2);
  padding: 8px 14px 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.tp-section-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
  opacity: .7;
}

/* ── Kanban boards ── */
.tp-top-kanban {
  flex: 1;
  display: flex;
  align-items: flex-start;
  /* columns sit at top, don't stretch full height */
  gap: 8px;
  overflow-x: auto;
  /* scroll left-right when many techs */
  overflow-y: hidden;
  padding: 10px 12px;
}

.tp-bottom-kanban {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

/* ── Columns ── */
.tp-col {
  flex-shrink: 0;
  width: 190px;
  max-height: 100%;
  /* cap column to container height … */
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-y: auto;
  /* … then scroll vertically inside */
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.tp-route-col {
  width: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
}

.tp-col-header {
  background: rgba(124, 58, 237, .12);
  padding: 10px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tp-route-header {
  background: rgba(255, 20, 147, .08);
  border-bottom-color: var(--border2);
}

.tp-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.tp-col-name {
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Lanes ── */
.tp-lane {
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
}

.tp-lane:last-child {
  border-bottom: none;
}

.tp-lane.tp-drag-over {
  background: rgba(124, 58, 237, .14);
}

.tp-lane-label {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text2);
  padding: 5px 8px 2px;
}

.tp-lane.tp-drag-over .tp-lane-label {
  color: var(--accent2);
}

.tp-lane-cards {
  padding: 2px 6px 6px;
  min-height: 36px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Cards ── */
.tp-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: grab;
  user-select: none;
  transition: border-color var(--trans), box-shadow var(--trans), opacity var(--trans);
  font-size: .78rem;
}

.tp-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(124, 58, 237, .2);
}

.tp-card.tp-dragging {
  opacity: .3;
  cursor: grabbing;
}

.tp-card-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  font-weight: 500;
}

.tp-card-hrs {
  font-size: .7rem;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(167, 139, 250, .12);
  padding: 1px 5px;
  border-radius: 99px;
  flex-shrink: 0;
}

/* ── Drop hint ── */
.tp-drop-hint {
  font-size: .68rem;
  color: var(--text3);
  opacity: 0;
  text-align: center;
  padding: 2px 0;
  pointer-events: none;
  transition: opacity var(--trans);
}

.tp-lane.tp-drag-over .tp-drop-hint {
  opacity: .8;
  color: var(--accent2);
}

/* ── Legend ── */
.tp-map-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 7px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tp-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .73rem;
  color: var(--text2);
  font-weight: 500;
}

.tp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   TASKS KANBAN
   ══════════════════════════════════════════════ */

.tasks-kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 20px;
}

/* ── Columns ── */
.tkan-col {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 230px;
  flex: 1;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
  transition: border-color var(--trans);
}

.tkan-col.tkan-col-over {
  border-color: var(--accent2);
  background: rgba(124, 58, 237, .05);
}

.tkan-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tkan-col-count {
  background: var(--bg);
  border-radius: 99px;
  font-size: .7rem;
  padding: 1px 7px;
  color: var(--text2);
}

.tkan-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  flex: 1;
}

.tkan-empty {
  color: var(--text2);
  font-size: .8rem;
  padding: 6px 4px;
  opacity: .45;
}

/* ── Cards ── */
.tkan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  position: relative;
  transition: background var(--trans), border-color var(--trans), box-shadow var(--trans);
}

.tkan-card:hover {
  background: rgba(124, 58, 237, .06);
  border-color: var(--border2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.tkan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.tkan-job-num {
  font-size: .7rem;
  font-weight: 700;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.tkan-menu-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 4px;
  border-radius: 4px;
  transition: background var(--trans), color var(--trans);
}

.tkan-menu-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.tkan-card-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.tkan-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tkan-pill {
  font-size: .72rem;
  border-radius: 99px;
  padding: 2px 8px;
  font-weight: 500;
}

.tkan-pill-tech {
  background: rgba(45, 212, 191, .12);
  color: #2dd4bf;
}

.tkan-pill-client {
  background: rgba(96, 165, 250, .1);
  color: #60a5fa;
}

.tkan-pill-deadline {
  background: rgba(239, 68, 68, .1);
  color: #f87171;
}

.tkan-pill-collab {
  background: rgba(139, 92, 246, .15);
  border: 1px solid rgba(139, 92, 246, .25);
  color: #a78bfa;
  font-weight: 600;
}

/* ── Admin Tech Tasks: manager personal column accent ── */
.tkan-col--mgr .tkan-col-header,
.tkan-col-header--mgr {
  background: linear-gradient(135deg, rgba(45,212,191,.12) 0%, rgba(20,184,166,.06) 100%);
  border-bottom: 2px solid rgba(45,212,191,.3);
  color: #2dd4bf !important;
}

/* ── Card context menu ── */
.tkan-card-menu {
  position: absolute;
  top: 32px;
  right: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  z-index: 100;
  overflow: hidden;
  min-width: 130px;
}

.tkan-card-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: .82rem;
  padding: 9px 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--trans);
}

.tkan-card-menu button:hover {
  background: var(--bg3);
}

.tkan-card-menu button.danger {
  color: var(--danger);
}

.tkan-card-menu button.danger:hover {
  background: rgba(239, 68, 68, .1);
}

/* ── Task Job Badge (in modal header) ── */
.task-job-badge {
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(124, 58, 237, .12);
  border-radius: 6px;
  padding: 2px 8px;
  margin-right: 8px;
  vertical-align: middle;
}

/* ── Client search inside task modal ── */
.task-client-search-wrap {
  position: relative;
}

.task-client-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1f1d2e;
  border: 1px solid rgba(124, 58, 237, .4);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .7);
  z-index: 1100;
  max-height: 220px;
  overflow-y: auto;
}

.task-client-opt {
  padding: 9px 14px;
  font-size: .85rem;
  cursor: pointer;
  transition: background var(--trans);
}

.task-client-opt:hover {
  background: var(--bg3);
}

/* ── @mention dropdown ── */
.mention-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1f1d2e;
  border: 1px solid rgba(124, 58, 237, .4);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .7);
  z-index: 1100;
  max-height: 200px;
  overflow-y: auto;
}

.mention-opt {
  padding: 8px 14px;
  font-size: .85rem;
  cursor: pointer;
  transition: background var(--trans);
}

.mention-opt:hover {
  background: var(--bg3);
}

.mention-link {
  color: var(--accent2);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Pic upload area ── */
.pic-upload-area {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pic-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pic-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.pic-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.pic-thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, .65);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: .65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Archives ── */
.archives-toolbar {
  margin-bottom: 14px;
}

.archives-toolbar input {
  width: 100%;
  max-width: 400px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--trans);
}

.archives-toolbar input:focus {
  border-color: var(--accent2);
}

.archive-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 7px;
  background: var(--bg3);
  flex-wrap: wrap;
}

.archive-jobnum {
  font-size: .88rem;
  font-weight: 700;
  color: var(--accent2);
  flex-shrink: 0;
  min-width: 50px;
}

.archive-body {
  flex: 1;
  min-width: 0;
}

.archive-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
}

.archive-meta {
  font-size: .76rem;
  color: var(--text2);
  margin-top: 2px;
}

.archive-pics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.arc-pic-link {
  font-size: .78rem;
  color: var(--accent2);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Notif job link ── */
.notif-joblink {
  color: var(--accent2);
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Form helpers used by task modal ── */
.form-label-sm {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text2);
  margin-bottom: 4px;
}

/* ══════════════════════════════════════════════
   SERVICE HISTORY
   ══════════════════════════════════════════════ */

.sh-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.sh-toolbar input {
  flex: 1;
  min-width: 200px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--trans);
}

.sh-toolbar input:focus {
  border-color: var(--accent2);
}

/* Delete dropdown */
.sh-delete-wrap {
  position: relative;
}

.sh-delete-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1f1d2e;
  border: 1px solid rgba(239, 68, 68, .3);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .6);
  z-index: 200;
  overflow: hidden;
  min-width: 180px;
}

.sh-delete-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(239, 68, 68, .1);
  color: var(--danger);
  font-family: inherit;
  font-size: .85rem;
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  transition: background var(--trans);
}

.sh-delete-menu button:last-child {
  border-bottom: none;
}

.sh-delete-menu button:hover {
  background: rgba(239, 68, 68, .1);
}

/* Table rows */
.sh-header-row,
.sh-row {
  display: grid;
  grid-template-columns: 160px 28px 1fr 180px 80px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.sh-header-row {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.sh-row {
  font-size: .85rem;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
  transition: background var(--trans);
}

.sh-row:hover {
  background: rgba(124, 58, 237, .04);
}

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

.sh-col-tech {
  color: var(--accent2);
  font-weight: 600;
}

.sh-col-check {
  text-align: center;
}

.sh-col-client {
  color: var(--text);
  font-weight: 500;
}

.sh-col-date {
  color: var(--text2);
  font-size: .78rem;
}

.sh-col-photo {
  text-align: right;
}

.sh-photo-link {
  font-size: .78rem;
  color: var(--accent2);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ── Client modal visits ── */
.cv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.cv-check {
  font-size: .9rem;
  flex-shrink: 0;
}

.cv-body {
  flex: 1;
}

.cv-tech {
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent2);
}

.cv-date {
  font-size: .76rem;
  color: var(--text2);
  margin-top: 2px;
}

/* ── Portal load-more button ── */
.portal-history-more {
  display: block;
  margin-top: 10px;
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-family: inherit;
  font-size: .82rem;
  padding: 8px;
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
}

.portal-history-more:hover {
  background: var(--bg3);
  color: var(--text);
}

/* ══════════════════════════════════════════════
   GOOGLE PLACES AUTOCOMPLETE — dark theme
   ══════════════════════════════════════════════ */
.pac-container {
  background: #1f1d2e !important;
  border: 1px solid rgba(124, 58, 237, .4) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .7) !important;
  margin-top: 4px !important;
  font-family: inherit !important;
  overflow: hidden;
}

.pac-item {
  background: transparent !important;
  border-top: 1px solid rgba(255, 255, 255, .05) !important;
  color: var(--text, #e2e0f0) !important;
  padding: 10px 14px !important;
  font-size: .875rem !important;
  cursor: pointer !important;
  transition: background .15s ease !important;
}

.pac-item:first-child {
  border-top: none !important;
}

.pac-item:hover,
.pac-item-selected {
  background: rgba(124, 58, 237, .15) !important;
}

.pac-item-query {
  color: #c4b5fd !important;
  font-size: .875rem !important;
  font-weight: 600 !important;
}

.pac-matched {
  color: #a78bfa !important;
  font-weight: 700 !important;
}

.pac-icon {
  display: none !important;
}

.pac-logo::after {
  display: none !important;
}

/* \u2550\u2550 SALARIES TAB \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
.sal-tech-card {
  margin-bottom: 14px;
}

.sal-tech-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sal-tech-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sal-tech-info {
  flex: 1;
  min-width: 0;
}

.sal-tech-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.sal-tech-sub {
  font-size: .78rem;
  color: var(--text2);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sal-past-list {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.sal-past-header {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
  margin-bottom: 8px;
}

.sal-past-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

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

.sal-past-label {
  font-size: .82rem;
  color: var(--text);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Salaries column layout ─────────────────────────────────────────── */
.sal-columns-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

@media (max-width: 900px) {
  .sal-columns-wrap { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .sal-columns-wrap { grid-template-columns: 1fr; }
}

.sal-col {
  background: var(--bg2);
  border: 3px solid rgba(255,255,255,.35);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sal-col-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 3px solid rgba(255,255,255,.35);
  background: var(--bg3);
}

.sal-col-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,.3);
}

.sal-col-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sal-col-body {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

/* ── Period entry row ─────────────────────────────────────────────── */
.sal-period-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 18px;
  cursor: pointer;
  border-bottom: 3px solid rgba(255,255,255,.35);
  transition: background var(--trans);
}

.sal-period-entry:hover {
  background: rgba(124, 58, 237, .08);
}

.sal-period-entry:last-child {
  border-bottom: none;
}

.sal-period-entry-left {
  flex: 1;
  min-width: 0;
}

.sal-period-label {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sal-period-sub {
  font-size: .72rem;
  color: var(--text2);
  margin-top: 2px;
}

.sal-period-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sal-period-pct {
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent2);
}

.sal-period-warn {
  color: #fbbf24;
  font-size: .78rem;
}

.sal-period-chevron {
  font-size: .72rem;
  color: var(--text2);
  opacity: .5;
}

.sal-col-empty {
  padding: 20px 14px;
  font-size: .82rem;
  color: var(--text2);
  text-align: center;
  font-style: italic;
}

/* ── Lock button ────────────────────────────────── */
/* ── Salaries status badges ──────────────────── */
.sal-status-badge {
  font-size: .63rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: .3px;
  flex-shrink: 0;
}
.sal-status-badge--live {
  background: rgba(74,222,128,.1);
  color: #4ade80;
  border: 3px solid rgba(255,255,255,.35);
}
.sal-status-badge--ended {
  background: rgba(251,191,36,.1);
  color: #fbbf24;
  border: 3px solid rgba(255,255,255,.35);
}

/* ── Pay info sent? button ───────────────────── */
.sal-mark-sent-btn {
  background: none;
  border: 3px solid rgba(255,255,255,.35);
  border-radius: 20px;
  color: #4ade80;
  font-size: .68rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 9px;
  line-height: 1.6;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
  letter-spacing: .2px;
}
.sal-mark-sent-btn:hover {
  background: rgba(74,222,128,.1);
  border-color: rgba(74,222,128,.55);
}

/* ── Sent period (slim row) ──────────────────── */
.sal-period-entry--sent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  gap: 8px;
  border-bottom: 3px solid rgba(255,255,255,.35);
}
.sal-period-label--sent {
  font-size: .78rem;
  color: var(--text);
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sal-sent-pill {
  font-size: .63rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(74,222,128,.15);
  color: #4ade80;
  border: 3px solid rgba(255,255,255,.35);
  white-space: nowrap;
  flex-shrink: 0;
}

/* In Progress pill (live period) */
.sal-in-progress-pill {
  font-size: .63rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(56,189,248,.12);
  color: #38bdf8;
  border: 3px solid rgba(255,255,255,.35);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Live period row — compact, no hover interaction */
.sal-period-entry--live {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  opacity: .55;
  gap: 8px;
  border-bottom: 3px solid rgba(255,255,255,.35);
  cursor: default;
}

/* Ended + not-sent row — slightly highlighted */
.sal-period-entry--pending {
  border-left: 2px solid rgba(251,191,36,.35);
}

/* Date range subtitle under label */
.sal-period-sub {
  font-size: .7rem;
  color: var(--text2);
  margin-top: 2px;
}

/* Ghost action buttons (View / PDF) on sent rows */
.sal-action-btn {
  font-size: .7rem;
  font-weight: 600;
  padding: 3px 9px;
  min-width: 58px;
  text-align: center;
  border-radius: 7px;
  background: rgba(255,255,255,.06);
  color: var(--text2);
  border: 1px solid rgba(255,255,255,.12);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.sal-action-btn:hover {
  background: rgba(255,255,255,.12);
  color: var(--text);
}
/* Square icon-only variant */
.sal-action-icon {
  min-width: unset;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
}


/* ── Enhanced quick-view row with hours + date ─────────────────── */
.sal-qv-row-grid {
  display: grid;
  grid-template-columns: 1fr 48px 90px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .83rem;
  color: var(--text);
}

.sal-qv-row-grid:last-child {
  border-bottom: none;
}

.sal-qv-row-status {
  text-align: right;
}

.sal-qv-row-hours {
  font-size: .78rem;
  font-weight: 600;
  color: var(--accent2);
  text-align: right;
}

.sal-qv-row-date {
  font-size: .72rem;
  color: var(--text2);
  text-align: right;
  white-space: nowrap;
}

/* \u2550\u2550 ADMIN SALARIES QUICK VIEW PANEL \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
.sal-qv-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
}

@media (min-width: 640px) {
  .sal-qv-overlay {
    align-items: stretch;
    justify-content: flex-end;
  }
}

.sal-qv-panel {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -16px 48px rgba(0,0,0,.6);
  animation: sal-slide-up .25s cubic-bezier(.4,0,.2,1);
}

@media (min-width: 640px) {
  .sal-qv-panel {
    border-radius: var(--radius) 0 0 var(--radius);
    width: 440px;
    max-height: 100dvh;
    box-shadow: -16px 0 48px rgba(0,0,0,.6);
    animation: sal-slide-right .25s cubic-bezier(.4,0,.2,1);
  }
}

@keyframes sal-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes sal-slide-right {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.sal-qv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg3);
  z-index: 1;
}

.sal-qv-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.sal-qv-body {
  padding: 18px 20px 32px;
  flex: 1;
}

.sal-qv-meta {
  font-size: .8rem;
  color: var(--text2);
  margin-bottom: 6px;
}

.sal-qv-section {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
  margin: 14px 0 8px;
}

.sal-qv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: .83rem;
  gap: 8px;
  color: var(--text);
}

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

.sal-qv-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 0;
  margin-top: 10px;
  border-top: 1px solid var(--border2);
  font-weight: 700;
  font-size: .9rem;
  color: var(--accent2);
}

/* \u2550\u2550 PRINT (admin salaries PDF) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
@media print {
  .sidebar, .main-content > *:not(.sal-qv-overlay) { display: none !important; }
  .sal-qv-overlay { position: static; background: none; backdrop-filter: none; }
  .sal-qv-panel {
    box-shadow: none; border: none; border-radius: 0;
    width: 100%; max-height: none; animation: none;
  }
  .sal-qv-header button { display: none; }
}
/* ── Mileage calculator widget (ended unsent PP rows) ────────────── */
.sal-miles-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.sal-miles-btn {
  font-size: .85rem;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(139,92,246,.15);
  border: 1px solid rgba(139,92,246,.3);
  border-radius: 7px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
  padding: 0;
}
.sal-miles-btn:hover { background: rgba(139,92,246,.3); }
.sal-miles-btn:disabled { opacity: .5; cursor: default; }
.sal-miles-val {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text2);
  min-width: 38px;
}

/* ── Ended (unsent) PP row — two-row layout ─────────────────────── */
.sal-period-entry--pending {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 10px 14px;
}
.sal-pending-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sal-pending-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.sal-pending-bottom .sal-period-sub {
  font-size: .68rem;
  flex-shrink: 0;
}
.sal-pending-bottom .sal-mark-sent-btn {
  margin-left: auto;
}

/* ── Company logo image replacements ─────────────────────────────── */
.logo-icon-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}
.portal-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}
.login-logo-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 50%;
}

/* ── TP Header Actions ────────────────────────────────────── */
.tp-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tp-action-btn {
  font-size: .78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid;
  transition: background var(--trans), color var(--trans);
}
.tp-reset-all-btn {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
  color: var(--text2);
}
.tp-reset-all-btn:hover { background: rgba(255,255,255,.12); color: var(--text); }
.tp-apply-btn {
  background: rgba(34,197,94,.15);
  border-color: rgba(34,197,94,.35);
  color: #4ade80;
}
.tp-apply-btn:hover { background: rgba(34,197,94,.25); }

/* ── Ghost cards (source of moved clients) ───────────────── */
.tp-ghost-card {
  opacity: .55;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  border: 1px dashed rgba(255,255,255,.18);
  margin-bottom: 3px;
  cursor: default;
}
.tp-ghost-name {
  text-decoration: line-through;
  font-size: .72rem;
  color: var(--text2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-reset-btn {
  font-size: .78rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: var(--text2);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.4;
  transition: background .12s;
}
.tp-reset-btn:hover { background: rgba(255,255,255,.18); color: var(--text); }

/* ── Moved card ──────────────────────────────────────────── */
.tp-moved-card {
  border-left: 3px solid currentColor;
}

/* ── Mini-map floating ───────────────────────────────────── */
.tp-mini-map {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 290px;
  height: 230px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: var(--bg2);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 9100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tp-mini-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.tp-mini-map-title {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .5px;
}
.tp-mini-map-expand {
  font-size: .9rem;
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .12s, background .12s;
}
.tp-mini-map-expand:hover { color: var(--text); background: rgba(255,255,255,.08); }

/* ── Apply Changes Modal ─────────────────────────────────── */
.tp-apply-modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 32px 28px 24px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.tp-apply-icon { font-size: 2.2rem; margin-bottom: 12px; }
.tp-apply-modal h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.tp-apply-modal p { color: var(--text2); font-size: .88rem; margin-bottom: 10px; line-height: 1.5; }
.tp-apply-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}
.btn-danger {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.35);
  color: #f87171;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.btn-danger:hover { background: rgba(239,68,68,.28); }

/* ── Compact ghost card (source placeholder) ─────────────── */
.tp-ghost-compact {
  padding: 2px 6px;
  min-height: unset;
  gap: 4px;
  margin-bottom: 2px;
  border-width: 1px;
}
.tp-ghost-compact .tp-ghost-name {
  font-size: .65rem;
}

/* ── Open Map button — centered in TP header ─────────────── */
.tp-map-open-btn {
  background: rgba(96,165,250,.12);
  border-color: rgba(96,165,250,.30);
  color: #60a5fa;
  margin: 0 auto;
}
.tp-map-open-btn:hover { background: rgba(96,165,250,.22); }

/* ── TP client search ─────────────────────────────────────── */
.tp-search-wrap {
  position: relative;
  flex: 0 0 200px;
}
.tp-search-input {
  width: 100%;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: .8rem;
  outline: none;
  transition: border-color .15s, background .15s;
}
.tp-search-input:focus {
  border-color: rgba(167,139,250,.5);
  background: rgba(255,255,255,.09);
}
.tp-search-input::placeholder { color: var(--text2); }

/* ── Pulsing highlighted card ─────────────────────────────── */
@keyframes tp-pulse-card {
  0%,100% { box-shadow: 0 0 0 2px #a78bfa; background: rgba(167,139,250,.15); }
  50%      { box-shadow: 0 0 0 5px rgba(167,139,250,.25); background: rgba(167,139,250,.28); }
}
.tp-highlighted {
  border-left: 3px solid #a78bfa !important;
  animation: tp-pulse-card 1.1s ease-in-out infinite;
  cursor: pointer;
}

/* ── Accounts Weekly highlighted card ────────────────────── */
@keyframes aw-pulse-card {
  0%,100% { box-shadow: 0 0 0 2px #a78bfa; background: rgba(167,139,250,.15); }
  50%      { box-shadow: 0 0 0 5px rgba(167,139,250,.25); background: rgba(167,139,250,.28); }
}
.kanban-card.aw-highlighted {
  border-left: 3px solid #a78bfa !important;
  animation: aw-pulse-card 1.1s ease-in-out infinite;
  cursor: pointer;
}

/* ── UNDO TOAST ─────────────────────────────── */
#aw-undo-toast {
  display: none;
  position: fixed;
  top: calc(var(--top-nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
  gap: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
  backdrop-filter: blur(14px);
  padding: 8px 16px;
  font-size: .82rem;
  color: var(--text);
  white-space: nowrap;
  z-index: 500;
}
#aw-undo-btn {
  background: rgba(124,58,237,.18);
  border: 1px solid rgba(124,58,237,.4);
  color: var(--accent2);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 12px;
  cursor: pointer;
  font-family: inherit;
}
#aw-undo-btn:hover { background: rgba(124,58,237,.3); }

/* ═══════════════════════════════════════════════════════════
   REPLACEMENTS + CHAT — Scaffold Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Rep lane (kanban board) ── */
.rep-lane { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rep-lane-header { padding: 10px 14px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text2); border-bottom: 1px solid var(--border); }
.rep-lane-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 80px; }

.rep-card { background: var(--bg3,#1a1928); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: border-color var(--trans); }
.rep-card:hover { border-color: var(--accent); }
.rep-card-number { font-size: .75rem; font-weight: 700; color: var(--accent); }
.rep-card-client { font-size: .85rem; font-weight: 600; color: var(--text); }
.rep-card-tech { font-size: .75rem; color: var(--text2); }

/* Rep number chip (history list) */
.rep-number-chip { display: inline-block; background: rgba(139,92,246,.15); color: var(--accent); border: 1px solid rgba(139,92,246,.3); border-radius: 99px; font-size: .73rem; font-weight: 700; padding: 2px 9px; }

.rep-history-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }

/* ── Chat layout ── */
.chats-container { display: flex; gap: 0; height: calc(100vh - var(--top-nav-h) - 80px); min-height: 400px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg2); }
.chats-sidebar { width: 220px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.chats-sidebar-header { padding: 12px 14px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text2); border-bottom: 1px solid var(--border); }
.chat-thread-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--trans); }
.chat-thread-item:hover, .chat-thread-item.active { background: rgba(139,92,246,.1); }
.chat-thread-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; flex-shrink: 0; }
.chat-thread-name { font-size: .85rem; font-weight: 500; color: var(--text); }

.chats-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chats-thread-header { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--border); font-size: .9rem; }
.chats-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text2); font-size: .9rem; }
.chats-empty span { font-size: 2.5rem; }

.chats-messages { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.chats-messages::-webkit-scrollbar, .chats-sidebar::-webkit-scrollbar, .chats-thread-list::-webkit-scrollbar { width: 5px; }
.chats-messages::-webkit-scrollbar-track, .chats-sidebar::-webkit-scrollbar-track, .chats-thread-list::-webkit-scrollbar-track { background: transparent; }
.chats-messages::-webkit-scrollbar-thumb, .chats-sidebar::-webkit-scrollbar-thumb, .chats-thread-list::-webkit-scrollbar-thumb { background: rgba(124,58,237,.35); border-radius: 99px; }
.chats-messages::-webkit-scrollbar-thumb:hover, .chats-sidebar::-webkit-scrollbar-thumb:hover, .chats-thread-list::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,.55); }
.chats-input-row { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); align-items: flex-end; }
.chats-input-row textarea { flex: 1; min-height: 38px; max-height: 120px; resize: none; }

/* ── Chat messages ── */
.chat-msg { display: flex; flex-direction: column; max-width: 75%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
.chat-msg-bubble { background: var(--bg3,#1a1928); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: .85rem; line-height: 1.45; word-break: break-word; }
.chat-msg.mine .chat-msg-bubble { background: rgba(139,92,246,.18); border-color: rgba(139,92,246,.3); }
.chat-msg.deleted .chat-msg-bubble { opacity: .5; font-style: italic; }
.chat-msg-meta { font-size: .7rem; color: var(--text2); margin-top: 3px; }

/* ── Chat tag chips ── */
.chat-tag-chip { display: inline; border-radius: 4px; font-size: .82rem; font-weight: 700; padding: 1px 5px; cursor: pointer; font-family: inherit; transition: background var(--trans); }
.chat-tag-chip--job { background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.25); color: #facc15; }
.chat-tag-chip--job:hover { background: rgba(250,204,21,.22); color: #fde047; }
.chat-tag-chip--rep { background: rgba(74,222,128,.12); border: 1px solid rgba(74,222,128,.25); color: #4ade80; }
.chat-tag-chip--rep:hover { background: rgba(74,222,128,.22); color: #86efac; }
.chat-tag-chip:not(.chat-tag-chip--job):not(.chat-tag-chip--rep) { background: rgba(139,92,246,.2); color: var(--accent); border: 1px solid rgba(139,92,246,.4); }
.chat-tag-chip:not(.chat-tag-chip--job):not(.chat-tag-chip--rep):hover { background: rgba(139,92,246,.35); }

/* ── Portal chat ── */
.portal-chat-box { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 8px; }
.portal-rep-card { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   REPLACEMENTS FEATURE — Full Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Badges ── */
.orchid-badge { display:inline-flex;align-items:center;gap:3px;background:rgba(168,85,247,.18);color:#c084fc;border:1px solid rgba(168,85,247,.35);border-radius:99px;font-size:.7rem;font-weight:700;padding:2px 8px; }
.billing-badge { display:inline-flex;align-items:center;border-radius:99px;font-size:.7rem;font-weight:700;padding:2px 8px; }
.billing-covered  { background:rgba(34,197,94,.15);color:#4ade80;border:1px solid rgba(34,197,94,.3); }
.billing-billable { background:rgba(251,191,36,.15);color:#fbbf24;border:1px solid rgba(251,191,36,.3); }

/* ── NEW counter badge button ── */
.rep-new-badge-btn { display:inline-flex;align-items:center;gap:6px;background:rgba(139,92,246,.2);border:1px solid rgba(139,92,246,.4);color:var(--accent);border-radius:99px;padding:5px 14px;font-size:.82rem;font-weight:700;cursor:pointer;transition:background var(--trans); }
.rep-new-badge-btn:hover { background:rgba(139,92,246,.35); }
.rep-new-badge-btn span { background:var(--accent);color:#fff;border-radius:50%;width:20px;height:20px;display:flex;align-items:center;justify-content:center;font-size:.72rem; }

/* ── Kanban layout ── */
.rep-kanban { display:flex;gap:14px;margin-top:16px;overflow-x:auto;padding-bottom:16px; }
.rep-filters { display:flex;gap:8px;flex-wrap:wrap;margin-bottom:4px; }
.rep-lane { flex:0 0 280px;display:flex;flex-direction:column;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden; }
.rep-lane-header { display:flex;align-items:center;justify-content:space-between;padding:10px 14px;font-size:.75rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--text2);border-bottom:1px solid var(--border); }
.rep-lane-count { background:var(--bg3,#1a1928);border-radius:99px;padding:1px 7px;font-size:.72rem; }
.rep-lane-body { flex:1;padding:8px;display:flex;flex-direction:column;gap:8px;min-height:80px;max-height:calc(100vh - 320px);overflow-y:auto; }
.rep-empty { color:var(--text2);font-size:.8rem;padding:12px;text-align:center; }

/* ── Rep card ── */
.rep-card { background:var(--bg3,#1a1928);border:1px solid var(--border);border-radius:var(--radius-sm);padding:12px;display:flex;flex-direction:column;gap:5px;cursor:pointer;transition:border-color var(--trans),box-shadow var(--trans); }
.rep-card:hover { border-color:var(--accent);box-shadow:0 0 0 1px var(--accent); }
.rep-card-head { display:flex;align-items:center;gap:6px;flex-wrap:wrap; }
.rep-card-number { font-size:.72rem;font-weight:800;color:var(--accent);letter-spacing:.04em; }
.rep-card-client { font-size:.92rem;font-weight:700;color:var(--text); }
.rep-card-plant { font-size:.82rem; color:#86efac; font-weight:600; }
.rep-archive-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2, #1e293b); border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 8px; padding: 10px 14px; font-size: .85rem;
}
.rep-photo-badge {
  position: absolute; top: 6px; right: 8px;
  font-size: .7rem; padding: 2px 6px; border-radius: 6px;
  font-weight: 600; pointer-events: none;
}
.rep-photo-done { background: rgba(74,222,128,.15); color: #4ade80; }
.rep-photo-pending { background: rgba(220,38,38,.25); color: #ef4444; }
/* Replacements list view */
.rep-list-filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 14px;
}
.rep-filter-select {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 7px 12px; font-size: .82rem; font-family: inherit;
  outline: none; min-width: 160px;
}
.rep-filter-input {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 7px 12px; font-size: .82rem; font-family: inherit;
  outline: none; min-width: 200px;
}
.rep-filter-input:focus, .rep-filter-select:focus { border-color: var(--accent); }
.rep-list-count { margin-left: auto; font-size: .75rem; color: var(--text2); }
.rep-list-table {
  display: flex;
  flex-direction: column;
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 10px;
  overflow: hidden;
}
.rep-list-hdr {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  font-size: .72rem; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.18);
  text-align: center;
}
/* Subtle column dividers — not spreadsheet-y, just visual separation */
.rep-list-hdr > span:not(:last-child),
.rep-list-row > span:not(:last-child) {
  border-right: 1px solid rgba(255,255,255,.07);
}
.rep-col-sort { cursor: pointer; user-select: none; transition: color .15s; }
.rep-col-sort:hover { color: var(--accent); }
.rep-list-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  cursor: pointer; transition: background .12s;
  font-size: .85rem; color: var(--text);
  text-align: center;
}
.rep-list-row:hover { background: rgba(139, 92, 246, 0.14); }
/* Status pills */
.rep-status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}
/* Date pills */
.rep-date-pill {
  display: inline-block; padding: 3px 8px; border-radius: 20px;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.rep-date-green  { background: rgba(74,222,128,.15); color: #4ade80; }
.rep-date-orange { background: rgba(251,146,60,.18); color: #fb923c; }
.rep-date-red    { background: rgba(220,38,38,.22); color: #ef4444; }
.rep-date-na     { color: var(--text2); }
.rep-card-orchid { font-size:.75rem;color:#c084fc;font-weight:600; }
.rep-card-photo-row { display:flex;gap:6px;margin-top:2px; }
.rep-thumb { width:56px;height:56px;object-fit:cover;border-radius:6px;cursor:zoom-in;border:1px solid var(--border);transition:transform var(--trans); }
.rep-thumb:hover { transform:scale(1.08); }
.rep-no-photo { font-size:.7rem;color:var(--text2);font-style:italic; }
.rep-card-ts { display:flex;flex-direction:column;gap:1px;font-size:.68rem;color:var(--text2);margin-top:2px; }
.rep-card-ts span { display:block; }
.rep-card-actions { display:flex;gap:6px;margin-top:4px;flex-wrap:wrap; }

/* ── Metrics panel ── */
.metrics-panel { background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);margin-bottom:16px;overflow:hidden; }
.metrics-summary { padding:10px 16px;font-size:.82rem;font-weight:700;cursor:pointer;user-select:none;color:var(--text2);list-style:none; }
.metrics-summary::-webkit-details-marker { display:none; }
.metrics-body { padding:14px 16px;border-top:1px solid var(--border); }
.metrics-toggle-row { display:flex;gap:8px;margin-bottom:12px; }
.metrics-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:10px; }
.metric-cell { background:var(--bg3,#1a1928);border:1px solid var(--border);border-radius:var(--radius-sm);padding:10px 12px;text-align:center; }
.metric-orchid { border-color:rgba(168,85,247,.3); }
.metric-val { font-size:1.15rem;font-weight:700;color:var(--text); }
.metric-lbl { font-size:.68rem;color:var(--text2);margin-top:2px; }

/* ── Plant management ── */
.plant-row { display:flex;align-items:center;gap:8px;padding:8px 10px;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-sm);font-size:.85rem; }
.plant-name { font-weight:600;flex:1; }
.plant-inactive { opacity:.5; }

/* ── Rep history rows ── */
.rep-history-full-row { padding:10px 0;display:flex;flex-direction:column;gap:4px; }
.rep-card-ts { display:flex;flex-direction:column;gap:1px;font-size:.7rem;color:var(--text2); }

/* ── Portal: Tab toggle ── */
.portal-section-toggle { display:flex;gap:6px;margin:12px 0 0; }
.portal-toggle-btn { display:flex;align-items:center;gap:6px;padding:7px 16px;border-radius:99px;border:1px solid var(--border);background:transparent;color:var(--text2);font-size:.82rem;font-weight:600;cursor:pointer;transition:all var(--trans);font-family:inherit; }
.portal-toggle-btn.portal-toggle-active { background:rgba(139,92,246,.2);border-color:rgba(139,92,246,.4);color:var(--accent); }
.portal-task-badge { background:var(--danger,#ef4444);color:#fff;border-radius:99px;font-size:.65rem;font-weight:700;padding:1px 5px;min-width:14px;text-align:center; }

/* ── Portal: Full rep card ── */
.portal-rep-card-full { background:var(--bg2,#12111e);border:1px solid var(--border);border-radius:var(--radius-sm);padding:12px;display:flex;flex-direction:column;gap:4px;margin-bottom:8px; }

/* ── Rep number chip ── */
.rep-number-chip { display:inline-block;background:rgba(139,92,246,.15);color:var(--accent);border:1px solid rgba(139,92,246,.3);border-radius:99px;font-size:.73rem;font-weight:700;padding:2px 9px; }

/* ── Section label ── */
.section-label { font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--text2); }

/* ═══════════════════════════════════════════════════════════
   CHAT SYSTEM — Full Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Layout ── */
.chats-container { display:flex;height:calc(100vh - 120px);gap:0;overflow:hidden; }

/* ── Sidebar ── */
.chats-sidebar { width:280px;flex-shrink:0;border-right:1px solid var(--border);display:flex;flex-direction:column;overflow:hidden; }
.chats-sidebar-top { display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid var(--border); }
.chats-sidebar-header { font-weight:700;font-size:.85rem;color:var(--text2);text-transform:uppercase;letter-spacing:.04em; }
/* Desktop: hide sidebar broadcast icon — page header already has the full Broadcast button */
@media (min-width: 769px) {
  .chat-broadcast-btn { display: none !important; }
}

/* Thread rows */
#chats-thread-list { flex:1;overflow-y:auto; }
.chat-thread-item { display:flex;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;border-bottom:1px solid var(--border);transition:background var(--trans); }
.chat-thread-item:hover { background:var(--bg3,#1a1928); }
.chat-thread-item.active { background:rgba(139,92,246,.12);border-left:3px solid var(--accent); }
.chat-thread-avatar-wrap { position:relative;flex-shrink:0; }
.chat-thread-avatar { display:flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:50%;background:rgba(139,92,246,.25);color:var(--accent);font-weight:700;font-size:.9rem;flex-shrink:0; }
.chat-thread-info { flex:1;min-width:0; }
.chat-thread-name { font-weight:600;font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.chat-thread-preview { font-size:.75rem;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px; }
.chat-thread-meta { display:flex;flex-direction:column;align-items:flex-end;gap:4px;flex-shrink:0; }
.chat-thread-time { font-size:.65rem;color:var(--text2); }
.chat-unread-badge { background:var(--accent);color:#fff;border-radius:99px;font-size:.65rem;font-weight:700;padding:2px 6px;min-width:16px;text-align:center; }
.chat-mention-badge { background:var(--accent);color:#fff;font-size:.6rem;font-weight:800;width:18px;height:18px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;animation:mentionPulse 1.5s ease-in-out infinite; }
@keyframes mentionPulse { 0%,100%{box-shadow:0 0 0 0 rgba(124,58,237,.4)} 50%{box-shadow:0 0 0 4px rgba(124,58,237,0)} }

/* ── @mention dropdown ── */
.team-mention-dropdown {
  position: fixed;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 999;
  box-shadow: 0 -4px 16px rgba(0,0,0,.4);
}
.team-mention-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer;
  transition: background var(--trans);
}
.team-mention-item:hover,
.team-mention-item.active { background: rgba(124,58,237,.12); }
.team-mention-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem; font-weight: 800; flex-shrink: 0;
}
.team-mention-name { font-size: .8rem; font-weight: 700; color: var(--text); }

/* ── Presence dot ── */
.presence-dot { position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;border:2px solid var(--bg,#0f0e1a); }
.presence-dot.online  { background:#22c55e; }
.presence-dot.offline { background:#6b7280; }

/* ── Nav badge ── */
.chat-nav-badge { position:absolute;top:4px;right:4px;background:var(--danger,#ef4444);color:#fff;border-radius:99px;font-size:.6rem;font-weight:700;padding:1px 5px;min-width:14px;text-align:center; }

/* ── Main panel ── */
.chats-main { flex:1;display:flex;flex-direction:column;overflow:hidden;position:relative; }
.chats-empty { display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:12px;color:var(--text2);font-size:.9rem; }
.chats-empty span { font-size:2.5rem; }

/* ── Thread header ── iMessage transparent overlay style */
.chats-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  flex-shrink: 0;
  gap: 10px;
  background: transparent;
  position: relative;
  z-index: 10;
}

/* Frosted circle buttons (back + search) */
.chat-hdr-circle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(20,18,38,.55);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.chat-hdr-circle:hover { background: rgba(20,18,38,.7); border-color: rgba(255,255,255,.25); }

/* Center: avatar + name stacked — each has frosted glass */
.chat-hdr-center {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; min-width: 0;
  transition: opacity .2s;
}
.chat-hdr-avatar {
  width: 34px !important; height: 34px !important;
  font-size: .9rem !important;
  background: rgba(20,18,38,.55) !important;
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.chat-hdr-name {
  font-size: .74rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
  background: rgba(20,18,38,.55);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  border-radius: 999px; padding: 3px 12px;
  margin-top: -6px; z-index: 1;
}

/* Search bar (hidden by default, expands when search is active) */
.chat-hdr-search-bar {
  flex: 1; display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.chat-hdr-search-bar .chat-search-input {
  flex: 1; width: 100%;
  background: rgba(20,18,38,.55);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 99px; padding: 7px 14px;
  font-size: .82rem; color: var(--text);
  font-family: inherit; outline: none;
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  transition: border-color .15s;
}
.chat-hdr-search-bar .chat-search-input:focus { border-color: var(--accent); }
.chat-hdr-search-close {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(239,68,68,.22);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(239,68,68,.35);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  color: #ef4444; font-size: .8rem; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.chat-hdr-search-close:hover { background: rgba(239,68,68,.35); }

/* ── Messages ── */
.chats-messages { flex:1;overflow-y:auto;padding:12px 16px;display:flex;flex-direction:column;gap:10px; }
.chat-msg-row { display:flex;flex-direction:column;max-width:72%; }
.chat-msg-row.mine  { align-self:flex-end;align-items:flex-end; }
.chat-msg-row.theirs { align-self:flex-start;align-items:flex-start; }
.chat-sender-label { font-size:.7rem;color:var(--text2);padding:0 6px;margin-bottom:2px; }
.chat-bubble { border-radius:16px;padding:9px 13px;max-width:100%;word-break:break-word; }
.bubble-mine  { background:var(--accent);color:#fff;border-bottom-right-radius:4px; }
.bubble-theirs { background:var(--bg3,#1a1928);color:var(--text);border-bottom-left-radius:4px; }
.bubble-text { font-size:.88rem;line-height:1.45; }
.bubble-meta { font-size:.65rem;opacity:.7;margin-top:4px;display:flex;gap:6px; }
.chat-edited { font-style:italic; }
.chat-read-receipt { font-size:.65rem;margin-top:2px;color:var(--text2); }
.chat-read-receipt.read { color:var(--accent); }
.chat-last-seen { display:block;font-size:.68rem;color:var(--text3);margin-top:1px; }
.chat-last-seen.read { color:var(--success);opacity:.8; }

/* ── Unread messages divider ── */
.chat-unread-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  margin: 4px 0;
}
.chat-unread-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(239, 68, 68, .45);
}
.chat-unread-divider-label {
  font-size: .68rem;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: .08em;
  white-space: nowrap;
  text-transform: uppercase;
}

/* Highlight from search */
.msg-highlight .chat-bubble { outline:2px solid var(--accent); }

/* Deleted message */
.deleted-msg { background:transparent!important;border:1px dashed var(--border)!important;font-style:italic; }

/* ── Images in chat ── */
.chat-img-thumb { max-width:200px;max-height:200px;border-radius:10px;cursor:zoom-in;object-fit:cover;margin-top:4px; }
.chat-img-preview-strip { display:flex;gap:6px;flex-wrap:wrap;padding:4px 12px; }
.chat-img-preview { position:relative; }
.chat-img-preview img { width:56px;height:56px;object-fit:cover;border-radius:6px;border:1px solid var(--border); }
.chat-img-remove { position:absolute;top:-5px;right:-5px;background:var(--danger,#ef4444);color:#fff;border:none;border-radius:50%;width:16px;height:16px;font-size:.6rem;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0; }

/* ── Image upload button ── */
.chat-img-btn { display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:1.1rem;padding:4px 8px;border-radius:8px;transition:background var(--trans);flex-shrink:0; }
.chat-img-btn:hover { background:var(--bg3,#1a1928); }

/* ── Input area ── */
.chats-input-row { display:flex;align-items:flex-end;gap:6px;padding:10px 12px;border-top:1px solid var(--border);flex-shrink:0; }
.chats-textarea { flex:1;resize:none;background:var(--bg2);border:1px solid var(--border);border-radius:12px;padding:8px 12px;color:var(--text);font-size:.88rem;font-family:inherit;line-height:1.45;max-height:120px;overflow-y:auto; }
/* Contenteditable div acting as textarea */
.chats-textarea[contenteditable] { min-height:36px;white-space:pre-wrap;word-break:break-word;cursor:text;outline:none; }
.chats-textarea[contenteditable]:empty::before { content:attr(data-placeholder);color:var(--text2);pointer-events:none; }

/* ── Tag pill chip (inside contenteditable composer) ── */
.portal-tag-chip-live {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  background: rgba(124,58,237,0.18);
  color: #a78bfa;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(139,92,246,0.35);
  line-height: 1.6;
  user-select: none;
  cursor: default;
}

/* ── Reactions ── */
.chat-reactions { display:flex;gap:4px;flex-wrap:wrap;margin-top:2px; }
.chat-reaction-chip { background:var(--bg3,#1a1928);border:1px solid var(--border);border-radius:99px;font-size:.75rem;padding:2px 8px;cursor:default;transition:background var(--trans);position:relative; }
.chat-reaction-chip.reacted { background:rgba(139,92,246,.2);border-color:var(--accent); }
.chat-reaction-chip:hover { background:rgba(139,92,246,.15); }
/* Fast custom tooltip */
.chat-reaction-chip[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #e2e8f0;
  font-size: .72rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.08);
}
.chat-reaction-chip[data-tooltip]:hover::after {
  opacity: 1;
  transition-delay: .2s;
}

/* ── Context menu ── */
.chat-context-menu { position:fixed;background:var(--bg2);border:1px solid var(--border);border-radius:12px;box-shadow:0 8px 32px rgba(0,0,0,.4);z-index:9000;min-width:160px;padding:6px;overflow:hidden; }
.ctx-item { display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;background:none;border:none;color:var(--text);font-size:.85rem;cursor:pointer;border-radius:8px;transition:background var(--trans);text-align:left;font-family:inherit; }
.ctx-item:hover { background:var(--bg3,#1a1928); }
.ctx-item.ctx-danger { color:var(--danger,#ef4444); }
.ctx-hr { border:none;border-top:1px solid var(--border);margin:4px 0; }

/* ── Tag chip ── */
.chat-tag-chip { background:rgba(139,92,246,.18);border:1px solid rgba(139,92,246,.3);color:var(--accent);border-radius:6px;padding:1px 6px;font-size:.82rem;font-weight:700;cursor:pointer;font-family:inherit;transition:background var(--trans); }
.chat-tag-chip--job { background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.25); color: #facc15; }
.chat-tag-chip--job:hover { background: rgba(250,204,21,.22); }
.chat-tag-chip--rep { background: rgba(74,222,128,.12); border: 1px solid rgba(74,222,128,.25); color: #4ade80; }
.chat-tag-chip--rep:hover { background: rgba(74,222,128,.22); }
.chat-tag-chip:hover { background:rgba(139,92,246,.3); }

/* ── Tag dropdown ── */
/* ── Tag autocomplete dropdown — premium frosted glass ── */
.chat-tag-dropdown {
  position: absolute; bottom: 70px; left: 12px; right: 12px;
  background: rgba(18,16,30,.82);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04) inset;
  z-index: 800;
  max-height: 140px;
  overflow-y: auto;
  padding: 6px;
}
.tag-dropdown-item {
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: .84rem;
  display: flex;
  gap: 10px;
  align-items: center;
  transition: background .15s, transform .1s;
}
.tag-dropdown-item:hover { background: rgba(255,255,255,.07); }
.tag-dropdown-item:active { transform: scale(.98); }
.tag-dropdown-item.disabled { color: var(--text2); cursor: default; opacity: .5; }
.tag-dropdown-item .tag-dd-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: .75rem; font-weight: 700;
  letter-spacing: .03em;
  flex-shrink: 0;
  white-space: nowrap;
}
.tag-dd-badge--job {
  background: rgba(250,204,21,.12);
  color: #facc15;
  border: 1px solid rgba(250,204,21,.2);
}
.tag-dd-badge--rep {
  background: rgba(74,222,128,.12);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,.2);
}
.tag-dropdown-item .tag-dd-desc {
  color: var(--text2);
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ── Tag detail side panel ── */
.tag-detail-panel { position:absolute;top:0;right:0;width:300px;height:100%;background:var(--bg2);border-left:1px solid var(--border);z-index:500;display:flex;flex-direction:column;transform:translateX(100%);transition:transform .25s ease; }
.tag-detail-panel.open { transform:translateX(0); }
.tag-panel-header { display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border);font-weight:700; }
.tag-panel-body { flex:1;overflow-y:auto; }

/* ── Media gallery ── */
.gallery-thumb-wrap { cursor:zoom-in;border-radius:8px;overflow:hidden;position:relative; }
.gallery-thumb { width:100%;height:140px;object-fit:cover;transition:transform var(--trans); }
.gallery-thumb-wrap:hover .gallery-thumb { transform:scale(1.04); }
.gallery-thumb-meta { position:absolute;bottom:0;left:0;right:0;background:rgba(0,0,0,.6);color:#fff;font-size:.65rem;padding:3px 6px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap; }

/* ── Broadcast history ── */
.chats-broadcast-history-wrap { border-top:1px solid var(--border);padding:0; }
.chats-bcast-toggle { width:100%;padding:10px 14px;background:none;border:none;color:var(--text2);font-size:.78rem;font-weight:600;text-align:left;cursor:pointer;display:flex;justify-content:space-between;font-family:inherit; }
.chats-bcast-toggle:hover { color:var(--text); }
.bcast-history-item { padding:10px 12px;border-top:1px solid var(--border);font-size:.8rem; }
.bcast-content { color:var(--text);margin-bottom:4px;line-height:1.4; }
.bcast-meta { color:var(--text2);font-size:.7rem; }
.bcast-receipts-detail summary { color:var(--text2);font-size:.72rem;cursor:pointer;margin-top:4px; }
.bcast-receipts-body { margin-top:6px;display:flex;flex-direction:column;gap:3px; }
.bcast-receipt-row { display:flex;justify-content:space-between;font-size:.72rem;padding:2px 0; }
.bcast-read   { color:#4ade80; }
.bcast-unread { color:var(--text2); }

/* ── Replacement submission success screen ── */
.rep-success-icon {
  font-size: 3.5rem;
  animation: repSuccessPop .45s cubic-bezier(.175,.885,.32,1.275) both;
}
.rep-success-number {
  display: inline-block;
  background: rgba(139,92,246,.18);
  border: 1px solid rgba(139,92,246,.35);
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .04em;
  border-radius: 99px;
  padding: 4px 18px;
  margin: 6px 0 4px;
}
@keyframes repSuccessPop {
  0%   { transform: scale(0.3); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── Rep card: tech row ─────────────────────────── */
.rep-card { cursor: pointer; transition: box-shadow .15s, transform .12s; }
.rep-card:hover { box-shadow: 0 4px 24px rgba(139,92,246,.25); transform: translateY(-1px); }
.rep-card-tech {
  display: flex; align-items: center; gap: 5px;
  font-size: .8rem; color: var(--text2); margin: 2px 0 4px;
}
.rep-tech-label { font-size: .75rem; }
.rep-tech-name  { font-weight: 600; color: var(--text1); }
.rep-override-dot { color: var(--accent-warm,#f59e0b); font-size: .8rem; margin-left: 2px; }

/* ── Rep detail panel ───────────────────────────── */
.rep-detail-section {
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px; padding: 12px;
}
.rep-detail-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: .85rem;
}
.rep-detail-row span { color: var(--text2); }
.rep-detail-row strong { text-align: right; }
.rep-detail-override {
  background: rgba(139,92,246,.12);
  border: 1px solid rgba(139,92,246,.35);
  border-radius: 8px; padding: 10px 12px;
}
.rep-detail-ts {
  width: 100%; border-collapse: collapse; font-size: .8rem;
}
.rep-detail-ts td {
  padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,.12);
}
.rep-detail-ts td:first-child { color: var(--text2); }
.rep-detail-ts td:last-child   { text-align: right; font-weight: 500; }

/* Collab chips in rep detail */
.collab-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.3);
  color: #60a5fa; font-size: .75rem; font-weight: 600;
  padding: 2px 8px 2px 10px;
  border-radius: 99px; white-space: nowrap;
}
.collab-chip-x {
  background: none; border: none; color: rgba(255,255,255,.4);
  cursor: pointer; font-size: .7rem; padding: 0 2px;
  transition: color .12s;
}
.collab-chip-x:hover { color: #f87171; }

/* Orchid form: size toggle buttons */
.nrf-toggle-btn {
  flex: 1; padding: 7px 0; border: 1px solid var(--border2, rgba(255,255,255,.15));
  border-radius: 8px; background: transparent; color: var(--text2, rgba(255,255,255,.5));
  font-family: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.nrf-toggle-btn.active {
  background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.5);
  color: #a78bfa;
}
.nrf-toggle-btn:hover:not(.active) { border-color: rgba(255,255,255,.3); color: var(--text, #e2e8f0); }

/* Orchid form: color dots */
.nrf-color-dot {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  transition: box-shadow .15s, transform .12s; flex-shrink: 0;
}
.nrf-color-dot:hover { transform: scale(1.1); }
.nrf-color-dot.active { box-shadow: 0 0 0 3px rgba(124,58,237,.5); transform: scale(1.1); }

/* Photo upload button */
.nrf-upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.06); border: 1px dashed rgba(255,255,255,.2);
  border-radius: 8px; padding: 8px 16px;
  color: rgba(255,255,255,.6); font-family: inherit; font-size: .8rem;
  cursor: pointer; transition: all .15s;
}
.nrf-upload-btn:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.35); color: #e2e8f0; }
.nrf-thumb-preview {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12); cursor: pointer;
  transition: opacity .15s;
}
.nrf-thumb-preview:hover { opacity: .8; }

/* ── Portal: 3-tab bottom nav ──────────────────────────────── */
/* Data tab sub-tabs */
.data-subtab-bar {
  display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap;
}
.data-subtab {
  background: transparent; border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 8px; padding: 7px 16px;
  font-family: inherit; font-size: .82rem; font-weight: 600;
  color: var(--text2, rgba(255,255,255,.5)); cursor: pointer;
  transition: all .15s;
}
.data-subtab:hover { border-color: rgba(255,255,255,.25); color: var(--text, #e2e8f0); }
.data-subtab.active {
  background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.5);
  color: #a78bfa;
}

.portal-bottom-tabs {
  display: flex; gap: 0; margin: 16px 0 0;
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0 8px;
  overflow: hidden;
}
.pbt-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: .82rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.pbt-tab:hover { color: var(--text1); background: rgba(255,255,255,.04); }
.pbt-tab.pbt-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(139,92,246,.1);
}

/* ── Portal: bottom panel cards ───────────────────────────── */
.portal-bottom-panel {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

/* ── Portal: mobile layout ─────────────────────────────────── */
@media (max-width: 640px) {
  /* Container */
  .portal-container { padding: 10px 12px 100px; }

  /* Top header */
  .portal-header {
    flex-direction: column; align-items: flex-start; gap: 8px;
  }
  .portal-header-right { width: 100%; justify-content: space-between; }

  /* Pay period card */
  .portal-pay-card { padding: 14px; }
  .portal-pay-label { font-size: .8rem; }

  /* Week navigation */
  .week-nav { gap: 6px; }
  .week-nav-btn { padding: 6px 10px; font-size: .78rem; }

  /* Kanban: horizontal scroll on mobile */
  .portal-kanban { 
    display: flex; overflow-x: auto; gap: 10px; 
    padding-bottom: 8px; -webkit-overflow-scrolling: touch;
  }
  .portal-kanban .pk-col { min-width: 200px; flex-shrink: 0; }

  /* Tasks mini kanban */
  .ptask-kanban { flex-direction: column; gap: 10px; }
  .ptask-col { min-width: unset; }

  /* Bottom tabs */
  .portal-bottom-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pbt-tab { white-space: nowrap; padding: 8px 14px 10px; font-size: .8rem; }

  /* Bottom panels */
  .portal-bottom-panel { padding: 12px 10px; }

  /* Chat box */
  #portal-chat-messages { height: 260px !important; }
  .chats-input-row { gap: 6px; }
  .chats-input-row textarea { font-size: .85rem; }
  .chats-input-row button  { padding: 8px 12px; font-size: .82rem; }

  /* Replacement cards in portal */
  .portal-rep-card { padding: 10px 12px; }

  /* Progress bar section */
  .portal-progress-wrap { padding: 0 0 4px; }

  /* Modals full-screen on mobile */
  .modal-box { 
    width: 96vw !important; max-width: 96vw !important;
    max-height: 88vh; overflow-y: auto;
    margin: auto;
  }
  .modal-overlay { align-items: flex-end; padding-bottom: env(safe-area-inset-bottom); }

  /* Task cards */
  .ptask-card { padding: 10px; }
}

@media (max-width: 400px) {
  .portal-container { padding: 8px 8px 100px; }
  .portal-pay-card { padding: 12px 10px; }
  #portal-chat-messages { height: 220px !important; }
}

/* ── Rep tech pill ─────────────────────────────────────────── */
.rep-tech-pill {
  display: inline-block;
  align-self: flex-start;
  font-size: .72rem; font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
  margin: 4px 0 2px;
  letter-spacing: .01em;
  width: fit-content;
}
.rep-override-dot {
  font-size: .7rem;
  margin-left: 3px;
  opacity: .8;
  vertical-align: middle;
}

/* ── Portal Replacements List View ────────────────────────── */
.prl-list { display: flex; flex-direction: column; }
.prl-section-label { font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text2); padding: 12px 14px 6px; }
.prl-empty { color: var(--text2); font-size: .82rem; padding: 16px 14px; }
.prl-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: background .12s;
}
.prl-row:last-child { border-bottom: none; }
.prl-row:hover { background: rgba(255,255,255,.04); }
.prl-thumb {
  width: 28px; height: 28px; border-radius: 5px;
  object-fit: cover; flex-shrink: 0; cursor: zoom-in;
  border: 1px solid rgba(255,255,255,.1);
}
.prl-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.05); font-size: .8rem;
  border: 1px solid rgba(255,255,255,.08);
}
.prl-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow: hidden; }
.prl-client { font-size: .84rem; font-weight: 700; color: var(--text1); white-space: nowrap; }
.prl-status-badge {
  font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px;
  white-space: nowrap; flex-shrink: 0;
}
.prl-status-badge.s-new            { background: rgba(139,92,246,.2);  color: #a78bfa; border: 1px solid rgba(139,92,246,.35); }
.prl-status-badge.s-in_progress    { background: rgba(245,158,11,.17); color: #fbbf24; border: 1px solid rgba(245,158,11,.35); }
.prl-status-badge.s-ready_for_pickup { background: rgba(52,211,153,.17); color: #34d399; border: 1px solid rgba(52,211,153,.35); }
.prl-status-badge.s-completed      { background: rgba(107,114,128,.2); color: #9ca3af; border: 1px solid rgba(107,114,128,.3); }
.prl-plant { font-size: .8rem; color: var(--text1); white-space: nowrap; flex-shrink: 0; }
.prl-notes { font-size: .78rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.prl-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.prl-time { font-size: .72rem; color: var(--text2); white-space: nowrap; }
.prl-chat-btn {
  background: none; border: 1px solid rgba(255,255,255,.13); border-radius: 6px;
  color: var(--text2); font-size: .78rem; padding: 1px 6px; cursor: pointer;
  transition: background .12s, color .12s; line-height: 1.4;
}
.prl-chat-btn:hover { background: rgba(255,255,255,.08); color: var(--text1); }

/* ── PRL Column Layout (shared with Portal) ──────────────── */
.prl-header-row, .prl-row {
  display: flex; align-items: center; gap: 0; padding: 0;
}
.prl-header-row {
  padding: 6px 0 6px 14px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.prl-row {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: background .12s;
  cursor: default;
}
.prl-row:hover { background: rgba(255,255,255,.04); }
.prl-th {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text2); padding: 0 8px;
  white-space: nowrap; user-select: none;
  border-right: 1px solid rgba(255,255,255,.06);
}
.prl-th:last-child { border-right: none; }
.prl-col {
  font-size: .82rem; padding: 0 8px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  border-right: 1px solid rgba(255,255,255,.03);
}
.prl-col:last-child { border-right: none; }
.prl-rep-num {
  font-weight: 700; color: var(--accent); font-size: .78rem;
}
.prl-date-pill {
  display: inline-block; font-size: .68rem; font-weight: 700;
  padding: 1px 7px; border-radius: 99px;
}
.prl-date-green  { background: rgba(52,211,153,.18); color: #34d399; border: 1px solid rgba(52,211,153,.35); }
.prl-date-orange { background: rgba(251,191,36,.17);  color: #fbbf24; border: 1px solid rgba(251,191,36,.35); }
.prl-date-red    { background: rgba(248,113,113,.17); color: #f87171; border: 1px solid rgba(248,113,113,.35); }

/* Plant List columns */
.prl-col-name   { flex: 1; min-width: 0; font-weight: 600; color: var(--text); }
.prl-col-type   { width: 100px; flex-shrink: 0; }
.prl-col-active { width: 80px;  flex-shrink: 0; }
.prl-col-count  { width: 100px; flex-shrink: 0; text-align: center; }
.prl-col-cost   { width: 110px; flex-shrink: 0; }

/* Replacement Archive columns */
.prl-col-repnum  { width: 80px;  flex-shrink: 0; }
.prl-col-client  { width: 160px; flex-shrink: 0; font-weight: 600; color: #f1f5f9; }
.prl-col-plant2  { width: 130px; flex-shrink: 0; }
.prl-col-date2   { width: 100px; flex-shrink: 0; }
.prl-col-tech    { width: 110px; flex-shrink: 0; }
.prl-col-status2 { width: 140px; flex-shrink: 0; }
.prl-col-notes2  { flex: 1; min-width: 0; color: rgba(255,255,255,.42); }
.prl-col-actions { width: 50px;  flex-shrink: 0; text-align: center; }

/* ── Team section: tech color swatches ─────────────────────── */
.tuc-color-row {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; flex-wrap: wrap;
}
.tuc-color-label { font-size: .72rem; color: var(--text2); }
.tuc-swatch {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s;
  flex-shrink: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.tuc-swatch:hover { transform: scale(1.2); }
.tuc-swatch.active {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(255,255,255,.3);
}
.tuc-swatch.active::after {
  content: '✓';
  position: absolute;
  font-size: .65rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 2px rgba(0,0,0,.6);
  line-height: 1;
  pointer-events: none;
}
/* Whitewashed (pastel) swatches — dark checkmark for visibility */
.tuc-swatch--wash {
  border-color: rgba(0,0,0,.08);
}
.tuc-swatch--wash.active {
  border-color: rgba(0,0,0,.4);
  box-shadow: 0 0 0 2px rgba(0,0,0,.15);
}
.tuc-swatch--wash.active::after {
  color: rgba(0,0,0,.55);
  text-shadow: none;
}

/* Collapsible color picker row on desktop tech cards */
.tuc-color-collapse { position: relative; margin-top: 8px; }
.tuc-color-preview {
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer; padding: 3px 8px 3px 4px;
  border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg3);
  transition: background .12s;
  user-select: none;
}
.tuc-color-preview:hover { background: rgba(255,255,255,.06); }
.tuc-color-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); flex-shrink: 0;
}
.tuc-color-change-label { font-size: .72rem; color: var(--text2); white-space: nowrap; }
.tuc-color-chevron { font-size: .6rem; color: var(--text2); transition: transform .2s; line-height: 1; }
.tuc-color-collapse.expanded .tuc-color-chevron { transform: rotate(180deg); }
.tuc-swatches-panel { display: none; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tuc-color-collapse.expanded .tuc-swatches-panel { display: flex; }

/* ── Form Settings modal tabs ──────────────────────────────── */
.form-settings-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  overflow-x: auto;
}
.fst-tab {
  padding: 9px 14px; border: none; background: transparent;
  color: var(--text2); font-size: .8rem; font-weight: 600;
  cursor: pointer; font-family: inherit; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.fst-tab:hover { color: var(--text1); }
.fst-tab.fst-active { color: var(--accent); border-bottom-color: var(--accent); }

/* Chips list */
.fst-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fst-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 10px 3px 12px;
  font-size: .8rem; color: var(--text1); font-weight: 500;
}
.fst-chip-remove {
  border: none; background: none; color: var(--text2);
  cursor: pointer; font-size: .75rem; padding: 0 2px;
  line-height: 1; transition: color .15s;
}
.fst-chip-remove:hover { color: #f87171; }

/* ── Form Settings modal inputs ────────────────────────────── */
#fst-panel-pots input[type="text"],
#fst-panel-colors input[type="text"],
#fst-panel-stems input[type="text"] {
  background: var(--bg2, #1e1b2e);
  color: var(--text1, #f1f5f9);
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: var(--radius, 8px);
  padding: 8px 12px;
  font-size: .85rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
#fst-panel-pots input[type="text"]:focus,
#fst-panel-colors input[type="text"]:focus,
#fst-panel-stems input[type="text"]:focus {
  border-color: var(--accent, #a78bfa);
}
#fst-panel-pots input::placeholder,
#fst-panel-colors input::placeholder,
#fst-panel-stems input::placeholder {
  color: var(--text2, rgba(255,255,255,.35));
}

/* ── New Rep Form — client quick-pick chips ────────────────── */
.nrf-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
  max-height: 140px;
  overflow-y: auto;
}
.nrf-suggestion-chip {
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  background: var(--surface2, rgba(255,255,255,.06));
  color: var(--text1, #f1f5f9);
  font-size: .78rem; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.nrf-suggestion-chip:hover {
  background: rgba(167,139,250,.15);
  border-color: rgba(167,139,250,.4);
}
.nrf-suggestion-chip.nrf-chip-selected {
  background: rgba(167,139,250,.25);
  border-color: #a78bfa;
  color: #a78bfa;
  font-weight: 700;
}

/* ── New Rep Form — live client dropdown ───────────────────── */
.nrf-client-dd {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--bg2, #1e1b2e);
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 0 0 var(--radius,8px) var(--radius,8px);
  z-index: 999; max-height: 200px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.nrf-dd-item {
  padding: 8px 14px;
  font-size: .85rem;
  color: var(--text1, #f1f5f9);
  cursor: pointer;
  transition: background .1s;
}
.nrf-dd-item:hover { background: rgba(167,139,250,.15); }


/* ── Slack-style chat messages (shared: admin + portal) ─── */
.pcm-row {
  display: flex; gap: 10px;
  padding: 4px 14px;
  transition: background .15s ease, border-color .15s ease;
  border-bottom: 1px solid rgba(255,255,255,.04);
  position: relative;
}
.pcm-row:last-child { border-bottom: none; }
.pcm-row:hover {
  background: rgba(255,255,255,.04);
}
/* Left accent glow on hover */
.pcm-row::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .2s ease;
  border-radius: 0 2px 2px 0;
}
.pcm-row:hover::before { opacity: .6; }
/* Grouped messages from same author — tighter but still distinguishable */
.pcm-row + .pcm-row:has(.pcm-avatar-hidden) {
  padding-top: 1px;
  border-bottom: 1px solid rgba(255,255,255,.025);
}
/* First message from a new sender — add extra top spacing */
.pcm-row:has(.pcm-header) {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.05);
}
.pcm-row:has(.pcm-header):first-child { border-top: none; margin-top: 0; }

.pcm-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; letter-spacing: .3px;
  background: rgba(139,92,246,.25); color: #c4b5fd; margin-top: 2px;
}
.pcm-avatar-mine   { background: rgba(52,211,153,.2); color: #6ee7b7; }
.pcm-avatar-hidden { background: transparent !important; color: transparent !important; pointer-events: none; }
.pcm-avatar-ghost  { background: transparent; }

.pcm-body { flex: 1; min-width: 0; }

.pcm-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.pcm-name   { font-size: .83rem; font-weight: 700; color: #e2e8f0; }
.pcm-name-mine { color: #6ee7b7; }
.pcm-time   { font-size: .7rem; color: rgba(255,255,255,.35); }
.pcm-edited { font-size: .68rem; color: rgba(255,255,255,.3); }

.pcm-text   { font-size: .85rem; line-height: 1.5; color: rgba(255,255,255,.88); word-break: break-word; }
.pcm-imgs   { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pcm-deleted { font-size: .78rem; color: rgba(255,255,255,.3); font-style: italic; }

.chats-messages, #portal-chat-messages { padding: 10px 0 !important; }

/* ── Slack-style chat composer ────────────────────────────── */
.chats-composer {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Formatting toolbar */
.chats-fmt-bar {
  display: flex;
  gap: 2px;
  padding: 6px 10px 4px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.fmt-btn {
  width: 28px; height: 26px;
  border: none; background: transparent; cursor: pointer;
  color: rgba(255,255,255,.5);
  border-radius: 5px;
  font-size: .82rem; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.fmt-btn:hover { background: rgba(255,255,255,.1); color: #e2e8f0; }
.fmt-btn b { font-weight: 800; }
.fmt-btn i { font-style: italic; }
.fmt-btn u { text-decoration: underline; }
.fmt-btn s { text-decoration: line-through; }

/* Composer textarea */
.chats-composer textarea,
.chats-composer #portal-chat-input,
.chats-composer #chats-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #e2e8f0;
  font-size: .85rem;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  padding: 8px 14px 4px;
  height: auto;
  min-height: 28px;
  max-height: 160px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Action bar */
.chats-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
}
.chats-action-left {
  display: flex;
  align-items: center;
  gap: 2px;
}
.action-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  color: rgba(255,255,255,.45);
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.action-btn:hover  { background: rgba(255,255,255,.08); color: #e2e8f0; }
.action-btn svg { pointer-events: none; }

/* Mic active state */
.mic-active { color: #f87171 !important; background: rgba(248,113,113,.15) !important; }

/* Send button */
.chats-send-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border: none; cursor: pointer;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(124,58,237,.35);
}
.chats-send-btn:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(124,58,237,.5); }

/* ── Emoji picker: floating Slack-style popup ───────────────── */
.chats-composer { position: relative; overflow: visible !important; }

.emoji-picker {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 312px;
  max-height: 360px;
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
  z-index: 999;
  flex-direction: column;
  overflow: hidden;
}
.emoji-picker.open { display: flex; }

/* Search */
.emoji-picker-search-wrap {
  padding: 10px 10px 6px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.emoji-search {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: .82rem;
  padding: 7px 10px;
  outline: none;
  font-family: inherit;
}
.emoji-search::placeholder { color: rgba(255,255,255,.35); }
.emoji-search:focus { border-color: rgba(139,92,246,.6); }

/* Scrollable body */
.emoji-picker-body {
  overflow-y: auto;
  padding: 8px 8px 10px;
  flex: 1;
}
.emoji-picker-body::-webkit-scrollbar { width: 4px; }
.emoji-picker-body::-webkit-scrollbar-track { background: transparent; }
.emoji-picker-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* Category labels */
.emoji-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.35);
  padding: 8px 2px 4px;
}

/* Emoji grid */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
}
.emoji-item {
  width: 30px; height: 30px;
  border: none; background: transparent; cursor: pointer;
  font-size: 1.1rem; line-height: 1;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.emoji-item:hover { background: rgba(255,255,255,.1); }

.emoji-empty {
  text-align: center; color: rgba(255,255,255,.3);
  font-size: .8rem; padding: 20px 0;
}

/* ── Edit history (admin-only expandable) ─────────────────── */
.pcm-edited-wrap { display: inline-flex; flex-direction: column; }
.pcm-edited-btn {
  display: inline-flex; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.3); font-size: .72rem; font-family: inherit;
  padding: 0; margin-top: 2px;
  transition: color .15s;
}
.pcm-edited-btn:hover { color: rgba(255,255,255,.6); }
.edit-history-box {
  margin-top: 6px;
  border-left: 2px solid rgba(255,255,255,.12);
  padding-left: 10px;
}
.edit-history-item { margin-bottom: 6px; }
.edit-history-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: rgba(255,255,255,.3);
  display: block; margin-bottom: 2px;
}
.edit-history-text {
  font-size: .8rem; color: rgba(255,255,255,.45);
  font-style: italic; line-height: 1.4;
}

/* ── Portal-specific composer overrides ──────────────────────
   Force same look as admin chat regardless of portal.css base styles */
.portal-chat-box .chats-composer {
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,.05) !important;
  overflow: visible !important;
  display: flex !important;
  flex-direction: column !important;
}
.portal-chat-box .chats-fmt-bar {
  display: flex !important;
  gap: 2px !important;
  padding: 6px 10px 4px !important;
  border-bottom: 1px solid rgba(255,255,255,.06) !important;
}
.portal-chat-box .fmt-btn {
  width: 28px !important; height: 26px !important;
  border: none !important; background: transparent !important;
  cursor: pointer !important; color: rgba(255,255,255,.5) !important;
  border-radius: 5px !important; font-size: .82rem !important;
  display: flex !important; align-items: center !important;
  justify-content: center !important;
  font-family: inherit !important;
  transition: background .15s, color .15s !important;
}
.portal-chat-box .fmt-btn:hover {
  background: rgba(255,255,255,.1) !important;
  color: #e2e8f0 !important;
}
.portal-chat-box #portal-chat-input {
  background: transparent !important;
  border: none !important; outline: none !important;
  color: #e2e8f0 !important; font-size: .85rem !important;
  font-family: inherit !important; line-height: 1.4 !important;
  resize: none !important; padding: 8px 14px 4px !important;
  width: 100% !important; box-sizing: border-box !important;
  min-height: 28px !important; max-height: 160px !important;
  overflow-y: auto !important;
}
.portal-chat-box .chats-action-bar {
  display: flex !important; align-items: center !important;
  justify-content: space-between !important; padding: 4px 8px !important;
}
.portal-chat-box .chats-action-left {
  display: flex !important; align-items: center !important; gap: 2px !important;
}
.portal-chat-box .action-btn {
  width: 30px !important; height: 30px !important;
  display: flex !important; align-items: center !important;
  justify-content: center !important; border: none !important;
  background: transparent !important; cursor: pointer !important;
  color: rgba(255,255,255,.45) !important; border-radius: 6px !important;
}
.portal-chat-box .action-btn:hover {
  background: rgba(255,255,255,.08) !important;
  color: #e2e8f0 !important;
}
.portal-chat-box .chats-send-btn {
  width: 32px !important; height: 32px !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg,#7c3aed,#6d28d9) !important;
  border: none !important; cursor: pointer !important; color: #fff !important;
  display: flex !important; align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 8px rgba(124,58,237,.35) !important;
}

/* ── Context menu react picker ──────────────────────────────── */
.ctx-react-picker {
  padding: 6px 8px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
  max-height: 180px; overflow-y: auto;
}
.ctx-emoji-label {
  font-size: .64rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: rgba(255,255,255,.3);
  padding: 4px 2px 2px;
}
.ctx-emoji-grid { display: flex; flex-wrap: wrap; gap: 2px; }
.ctx-emoji-btn {
  width: 28px; height: 28px; border: none; background: transparent;
  cursor: pointer; font-size: 1rem; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.ctx-emoji-btn:hover { background: rgba(255,255,255,.1); }

/* ── Reply bar (above composer) ─────────────────────────────── */
.chat-reply-bar {
  display: none; align-items: center; gap: 10px;
  padding: 6px 12px;
  background: rgba(124,58,237,.1);
  border-left: 3px solid #7c3aed;
  border-radius: 6px;
  margin-bottom: 6px;
}
.reply-bar-content { flex: 1; min-width: 0; font-size: .8rem; color: #e2e8f0; }
.reply-bar-label { color: rgba(255,255,255,.4); font-size: .7rem; margin-right: 4px; }
.reply-bar-name { color: #a78bfa; margin-right: 6px; }
.reply-bar-text { color: rgba(255,255,255,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; display: inline-block; vertical-align: bottom; }
.reply-bar-close {
  background: none; border: none; color: rgba(255,255,255,.4);
  cursor: pointer; font-size: .9rem; padding: 4px; border-radius: 4px;
}
.reply-bar-close:hover { color: #e2e8f0; background: rgba(255,255,255,.08); }

/* ── Quoted reply in message ────────────────────────────────── */
.pcm-reply-quote {
  display: flex; flex-direction: column; gap: 1px;
  background: rgba(124,58,237,.08);
  border-left: 3px solid #7c3aed;
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background .15s;
  max-width: 340px;
}
.pcm-reply-quote:hover { background: rgba(124,58,237,.15); }
.pcm-reply-name { font-size: .72rem; font-weight: 700; color: #a78bfa; }
.pcm-reply-text { font-size: .74rem; color: rgba(255,255,255,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Thread sidebar (Slack-style) ───────────────────────────── */
.thread-sidebar {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 340px; max-width: 45%;
  background: var(--bg2, #1a1625);
  border-left: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column;
  z-index: 500;
  box-shadow: -4px 0 24px rgba(0,0,0,.3);
  animation: slideInRight .2s ease;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.thread-sidebar-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.thread-sidebar-title { font-weight: 700; font-size: .95rem; color: #e2e8f0; }
.thread-sidebar-close {
  background: none; border: none; color: rgba(255,255,255,.4);
  cursor: pointer; font-size: 1.1rem; padding: 4px 8px; border-radius: 6px;
}
.thread-sidebar-close:hover { color: #e2e8f0; background: rgba(255,255,255,.08); }
.thread-sidebar-parent {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
.thread-sidebar-replies {
  flex: 1; overflow-y: auto; padding: 10px 14px;
}
.thread-no-replies { color: rgba(255,255,255,.3); font-size: .82rem; text-align: center; padding: 20px 0; }
.thread-sidebar-composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.thread-sidebar-composer textarea {
  flex: 1; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1); border-radius: 8px;
  color: #e2e8f0; font-size: .82rem; font-family: inherit;
  padding: 8px 10px; resize: none; outline: none;
  min-height: 28px; max-height: 120px; overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS — Full Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Settings tabs ── */
.settings-tabs {
  display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap;
}
.settings-tab {
  background: transparent; border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 8px; padding: 8px 18px;
  font-family: inherit; font-size: .82rem; font-weight: 600;
  color: var(--text2, rgba(255,255,255,.5)); cursor: pointer;
  transition: all .15s;
}
.settings-tab:hover { border-color: rgba(255,255,255,.25); color: var(--text, #e2e8f0); }
.settings-tab.active {
  background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.5);
  color: #a78bfa;
}

/* ── Settings sections ── */
.settings-section {
  background: var(--bg2, #12111e); border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 12px; padding: 20px; margin-bottom: 18px;
}
.settings-section-title {
  font-size: .9rem; font-weight: 700; color: var(--text, #e2e8f0);
  margin-bottom: 14px;
}

/* ── Info grid ── */
.settings-info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.settings-info-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: rgba(255,255,255,.04);
  border-radius: 8px; font-size: .82rem;
}
.settings-info-label { color: var(--text2); font-weight: 500; }
.settings-info-value { color: var(--text); font-weight: 600; font-size: .78rem; text-align: right; }

/* ── Collection cards ── */
.settings-collections-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.settings-collection-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 10px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06); border-radius: 10px;
  transition: border-color .15s, background .15s;
}
.settings-collection-card:hover {
  border-color: rgba(139,92,246,.3); background: rgba(139,92,246,.06);
}
.settings-coll-icon { font-size: 1.4rem; }
.settings-coll-name { font-size: .78rem; font-weight: 600; color: var(--text); }
.settings-coll-count { font-size: 1.2rem; font-weight: 800; color: var(--accent, #a78bfa); }
.settings-coll-path { font-size: .65rem; color: var(--text2); font-family: monospace; }

/* ── Automation cards ── */
.automations-list { display: flex; flex-direction: column; gap: 12px; }
.automation-card {
  background: var(--bg2, #12111e); border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 12px; overflow: hidden; transition: border-color .15s;
}
.automation-card:hover { border-color: rgba(139,92,246,.25); }
.automation-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.automation-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: .88rem; color: var(--text);
}
.automation-toggle { cursor: pointer; font-size: .9rem; transition: opacity .15s; }
.automation-toggle:hover { opacity: .7; }
.automation-card-body { padding: 12px 16px; }
.automation-rule-row {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; margin-bottom: 6px;
}
.automation-rule-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  color: var(--text2); letter-spacing: .04em; min-width: 40px;
}
.automation-rule-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.25);
  border-radius: 6px; padding: 3px 10px; font-size: .78rem;
  color: var(--accent, #a78bfa); font-weight: 600;
}
.automation-rule-detail {
  font-size: .78rem; color: var(--text2); font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   ADMIN TASKS — Google Tasks Style
   ═══════════════════════════════════════════════════════════ */

/* ── Board layout ── */
.at-board {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

/* ── Column ── */
.at-col {
  flex: 0 0 240px; display: flex; flex-direction: column;
  background: var(--bg2, #12111e); border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 12px; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.at-col.at-drag-over {
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(139,92,246,.25);
}
.at-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; font-size: .88rem; font-weight: 700;
  color: var(--text); letter-spacing: .01em;
}
.at-col-count {
  background: rgba(255,255,255,.08); border-radius: 99px;
  font-size: .7rem; font-weight: 700; padding: 2px 7px; color: var(--text2);
}
.at-col-body {
  flex: 1; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - 260px); overflow-y: auto;
}

/* ── Add task button ── */
.at-add-row { margin-bottom: 6px; }
.at-add-btn {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 8px 10px; border: none; background: transparent;
  color: var(--text2); font-size: .82rem; font-family: inherit;
  cursor: pointer; border-radius: 8px; transition: background .12s;
}
.at-add-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }

/* ── Inline form ── */
.at-inline-form { padding: 0 2px; margin-bottom: 8px; }
.at-inline-input {
  width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; color: var(--text); font-size: .82rem; font-family: inherit;
  outline: none;
}
.at-inline-input:focus { border-color: var(--accent); }

/* Task title placeholder — bold uppercase */
.at-title-input::placeholder {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Client autocomplete dropdown */
.at-client-dropdown {
  position: absolute; left: 0; right: 0; top: 100%;
  z-index: 50;
  background: var(--bg2, #12111e);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  margin-top: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  overflow: hidden;
}
.at-client-option {
  padding: 7px 10px;
  font-size: .82rem;
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
}
.at-client-option:hover {
  background: rgba(124,58,237,.15);
  color: #fff;
}

/* ── Task card ── */
.at-task-card {
  display: flex; flex-direction: column; padding: 8px 8px;
  border-radius: 8px; cursor: pointer;
  transition: background .12s;
}
.at-task-card:hover { background: rgba(255,255,255,.05); }
.at-task-card.at-dragging { opacity: .5; }
.at-task-main {
  display: flex; align-items: flex-start; gap: 8px;
}

/* ── Checkbox button ── */
.at-check-btn {
  flex-shrink: 0; width: 22px; height: 22px;
  border: 2px solid rgba(255,255,255,.25); border-radius: 50%;
  background: transparent; color: transparent;
  font-size: .7rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
  margin-top: 1px;
}
.at-check-btn:hover {
  border-color: var(--accent); color: var(--accent);
}
.at-check-btn.at-checked {
  border-color: rgba(74,222,128,.5); background: rgba(74,222,128,.15);
  color: #4ade80;
}

/* ── Task content ── */
.at-task-content { flex: 1; min-width: 0; }
.at-task-title {
  font-size: .85rem; font-weight: 500; color: var(--text);
  line-height: 1.35; word-break: break-word;
}
.at-title-done {
  text-decoration: line-through; color: var(--text2); opacity: .7;
}
.at-task-notes {
  font-size: .72rem; color: var(--text2); margin-top: 2px;
  line-height: 1.3; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ── Deadline badges ── */
.at-deadline {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .68rem; font-weight: 600; padding: 2px 7px;
  border-radius: 4px; margin-top: 4px;
}
.at-deadline-past { background: rgba(239,68,68,.18); color: #f87171; }
.at-deadline-today { background: rgba(59,130,246,.18); color: #60a5fa; }
.at-deadline-tomorrow { background: rgba(251,191,36,.18); color: #fbbf24; }
.at-deadline-future { background: rgba(255,255,255,.06); color: var(--text2); }

/* ── Completed section ── */
.at-completed-section { margin-top: 8px; }
.at-completed-toggle {
  font-size: .78rem; font-weight: 600; color: var(--text2);
  cursor: pointer; padding: 6px 4px; list-style: none;
  user-select: none;
}
.at-completed-toggle::-webkit-details-marker { display: none; }
.at-completed-toggle::before {
  content: '▸ '; transition: transform .15s;
}
details[open] > .at-completed-toggle::before { content: '▾ '; }
.at-completed-list {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: 4px; padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.at-task-completed { opacity: .6; }
.at-task-completed:hover { opacity: .8; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .at-col { flex: 0 0 200px; }
}

/* ── Admin Tasks: Note Images ── */
.at-img-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* ── Admin Tasks: Inline form pending image preview strip ── */
.at-img-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  min-height: 0;
}
.at-img-preview-strip:empty { display: none; }  /* hide when no images */

.at-img-thumb {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.at-img-thumb img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(149,213,178,.35);  /* subtle green tint = "queued" */
  display: block;
}
.at-img-thumb-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #f87171;
  color: #fff;
  border: none;
  font-size: .6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .1s;
}
.at-img-thumb-remove:hover { transform: scale(1.15); }

/* 📷 Attach image button — styled like a deadline pill */
.at-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  font-size: .8rem;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s;
  min-height: 32px;
}
.at-attach-btn:hover {
  background: rgba(255,255,255,.11);
  color: var(--text);
}
.at-attach-btn::before { content: 'Attach photo'; }

.at-img-thumb-wrap {
  position: relative;
  display: inline-flex;
}
.at-img-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform .15s, box-shadow .15s;
}
.at-img-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.at-img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f87171;
  color: #fff;
  border: none;
  font-size: .7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity .15s;
}
.at-img-thumb-wrap:hover .at-img-remove { opacity: 1; }
.at-img-count {
  font-size: .7rem;
  color: var(--text2);
  margin-top: 4px;
}

/* ── Tech Scorecard Metrics ── */
.sc-metric-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
}
.sc-metric-val {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
}
.sc-metric-lbl {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}
.sc-metric-sub {
  font-size: .68rem;
  color: var(--text2);
  margin-top: 2px;
}

/* ═════════════════════════════════════════════════════
   DESKTOP CALENDAR LAYOUT — Google Calendar-style
   ═════════════════════════════════════════════════════ */

/* ── Two-panel layout ── */
.cal-desktop-layout {
  display: flex; flex-direction: column; height: calc(100vh - 60px);
}
.cal-desktop-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--bg);
}
.cal-desktop-body {
  display: flex; flex: 1; overflow: hidden;
}
.cal-sidebar {
  width: 240px; flex-shrink: 0; overflow-y: auto;
  border-right: 1px solid var(--border); padding: 12px;
  background: var(--bg); transition: width .2s;
}
.cal-desktop-content {
  flex: 1; overflow: auto;
  min-width: 0;
}
#cal-content {
  height: 100%;
}
/* Ensure month grid fills the content panel */
#cal-content > .cal-month-grid {
  width: 100%;
}

/* ── Top bar buttons ── */
.cdw-sidebar-toggle {
  background: none; border: none; color: var(--text2); font-size: 1.1rem;
  cursor: pointer; padding: 6px 8px; border-radius: 50%;
  transition: background .15s;
}
.cdw-sidebar-toggle:hover { background: rgba(255,255,255,.08); }
.cdw-today-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: .78rem; font-weight: 600; padding: 5px 16px;
  cursor: pointer; transition: background .15s;
}
.cdw-today-btn:hover { background: rgba(139,92,246,.12); }
.cdw-nav-btn {
  background: none; border: none; color: var(--text2); font-size: .8rem;
  cursor: pointer; padding: 6px 8px; border-radius: 50%;
  transition: background .15s;
}
.cdw-nav-btn:hover { background: rgba(255,255,255,.08); }
.cdw-topbar-label { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.cdw-view-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.cdw-view-btn {
  background: transparent; border: none; color: var(--text2); font-size: .78rem;
  font-weight: 600; padding: 5px 16px; cursor: pointer; transition: all .15s;
}
.cdw-view-btn.active { background: var(--accent2); color: #fff; }
.cdw-view-btn:hover:not(.active) { background: rgba(255,255,255,.06); }
.cdw-add-btn {
  background: rgba(139,92,246,.15); border: 1px solid rgba(139,92,246,.3);
  border-radius: 8px; color: var(--accent2); font-size: .78rem; font-weight: 700;
  padding: 6px 14px; cursor: pointer; transition: background .15s; white-space: nowrap;
}
.cdw-add-btn:hover { background: rgba(139,92,246,.25); }

/* ── Calendar Search ── */
.cal-search-wrap {
  position: relative;
  flex: 1; max-width: 600px; min-width: 200px;
}
.cal-search-input-wrap {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 10px;
  transition: border-color .15s, box-shadow .15s;
}
.cal-search-input-wrap:focus-within {
  border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(139,92,246,.15);
}
.cal-search-icon { font-size: .82rem; opacity: .5; flex-shrink: 0; }
.cal-search-input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: .82rem; font-family: inherit;
  width: 100%; padding: 3px 0;
}
.cal-search-input::placeholder { color: var(--text2); opacity: .6; }
.cal-search-clear {
  background: none; border: none; color: var(--text2);
  font-size: .78rem; cursor: pointer; padding: 2px 4px;
  border-radius: 4px; line-height: 1; flex-shrink: 0;
}
.cal-search-clear:hover { color: var(--text); background: rgba(255,255,255,.08); }
.cal-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 10px; box-shadow: 0 10px 36px rgba(0,0,0,.5);
  z-index: 200; max-height: 340px; overflow-y: auto;
}
.cal-search-results:empty { display: none; }
.cal-sr-empty {
  padding: 16px; text-align: center; font-size: .82rem;
  color: var(--text2); opacity: .6;
}
.cal-sr-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.cal-sr-item:last-child { border-bottom: none; }
.cal-sr-item:hover { background: rgba(139,92,246,.08); }
.cal-sr-item-main { flex: 1; min-width: 0; }
.cal-sr-title {
  font-size: .85rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.cal-sr-clip { font-size: .75rem; flex-shrink: 0; }
.cal-sr-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 2px; font-size: .72rem; color: var(--text2);
}
.cal-sr-client { color: var(--accent2); font-weight: 600; }
.cal-sr-tech { color: #4ade80; font-weight: 500; }
.cal-sr-date { opacity: .7; }
.cal-sr-type {
  font-size: .62rem; font-weight: 700; padding: 1px 6px;
  border-radius: 10px; letter-spacing: .3px; text-transform: uppercase;
}
.cal-sr-type-oneoff {
  background: rgba(139,92,246,.15); color: #a78bfa;
  border: 1px solid rgba(139,92,246,.25);
}
.cal-sr-type-recur {
  background: rgba(74,222,128,.12); color: #4ade80;
  border: 1px solid rgba(74,222,128,.2);
}

/* ── Mobile search button ── */
.cal-mobile-search-btn {
  display: none; /* shown via media query */
  background: none; border: none;
  font-size: 1.1rem; cursor: pointer; padding: 6px;
  line-height: 1; color: var(--text);
}

/* ── Mobile search bar (slides in, replaces topbar) ── */
.cal-mobile-search-bar {
  display: none; /* toggled by JS */
  align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.cal-mobile-search-bar .cal-search-results {
  position: absolute; top: calc(100% + 4px);
  left: 8px; right: 8px;
  max-height: 55vh;
}


/* ── Mini monthly calendar (sidebar) ── */
.csm-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.csm-label { font-size: .82rem; font-weight: 700; color: var(--text); }
.csm-nav {
  background: none; border: none; color: var(--text2); font-size: .7rem;
  cursor: pointer; padding: 4px 6px; border-radius: 50%;
}
.csm-nav:hover { background: rgba(255,255,255,.08); }
.csm-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
  text-align: center;
}
.csm-hdr {
  font-size: .6rem; font-weight: 700; color: var(--text2);
  padding: 4px 0; text-transform: uppercase;
}
.csm-day {
  font-size: .72rem; color: var(--text); padding: 4px 0;
  cursor: pointer; border-radius: 50%; line-height: 24px;
  width: 28px; height: 28px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.csm-day:hover { background: rgba(255,255,255,.08); }
.csm-dim { color: var(--text2); opacity: .4; }
.csm-today {
  background: var(--accent2); color: #fff !important; font-weight: 700;
  border-radius: 50%;
}

/* ── Sidebar filter sections ── */
.csf-section { margin-top: 16px; }
.csf-label {
  font-size: .68rem; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
}
.csf-group { margin-bottom: 2px; }
.csf-group-head {
  display: flex; align-items: center; gap: 8px; padding: 4px 2px;
  cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--text);
  border-radius: 4px; transition: background .12s;
}
.csf-group-head:hover { background: rgba(255,255,255,.06); }
.csf-member {
  display: flex; align-items: center; gap: 8px; padding: 3px 2px 3px 16px;
  cursor: pointer; font-size: .78rem; color: var(--text);
  border-radius: 4px; transition: background .12s;
}
.csf-member:hover { background: rgba(255,255,255,.06); }
.csf-check {
  width: 16px; height: 16px; border-radius: 3px; border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem; color: #fff; font-weight: 700; flex-shrink: 0;
  transition: background .12s;
}
.csf-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.csf-toggle-btn {
  flex: 1; background: transparent; border: none; color: var(--text2);
  font-size: .7rem; font-weight: 600; padding: 5px 4px; cursor: pointer;
  transition: all .12s;
}
.csf-toggle-btn.active { background: var(--accent2); color: #fff; }
.csf-toggle-btn:hover:not(.active) { background: rgba(255,255,255,.06); }

/* ── Desktop week time-grid (cdw-*) ── */
.cdw-wrap { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.cdw-header {
  display: grid; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5; background: var(--bg);
}
.cdw-gutter { /* empty top-left corner */ }
.cdw-day-header {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0; gap: 2px;
}
.cdw-day-name { font-size: .68rem; font-weight: 600; color: var(--text2); text-transform: uppercase; }
.cdw-day-num { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.cdw-today-header .cdw-day-name { color: var(--accent2); }
.cdw-today-num {
  background: var(--accent2); color: #fff !important;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.cdw-body {
  flex: 1; overflow-y: auto; position: relative;
}
.cdw-body-inner { position: relative; }
.cdw-row {
  display: grid; min-height: 56px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.cdw-time-label {
  font-size: .62rem; font-weight: 600; color: var(--text2);
  text-align: right; padding: 0 8px 0 0;
  position: relative; top: -6px;
}
.cdw-cell {
  border-left: 1px solid rgba(255,255,255,.06);
  cursor: pointer; transition: background .1s;
}
.cdw-cell:hover { background: rgba(139,92,246,.04); }
.cdw-dragover { background: rgba(139,92,246,.1) !important; }

/* Events */
.cdw-event {
  position: absolute; border-radius: 6px; padding: 3px 6px;
  font-size: .78rem; cursor: pointer; overflow: hidden;
  transition: box-shadow .12s, filter .12s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.cdw-event:hover { filter: brightness(1.1); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.cdw-event-title {
  font-weight: 600; display: -webkit-box; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.25;
}
.cdw-event-sub {
  font-size: .68rem; font-weight: 400; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Recurring arrow pattern — desktop */
.cdw-recurring {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='20' viewBox='0 0 10 20'%3E%3Cpath d='M1.5 5h6M5.5 3L8 5 5.5 7' stroke='rgba(0,0,0,0.25)' stroke-width='1.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 20px 20px;
  background-repeat: repeat;
}

/* ── Month grid (shared) ── */
.cal-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  grid-template-rows: auto; grid-auto-rows: 1fr;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; overflow: hidden;
  min-height: calc(100vh - 130px);
}
.cal-m-hdr {
  background: var(--bg3); padding: 8px; text-align: center; font-size: .72rem;
  font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px;
}
.cal-m-cell {
  background: var(--bg2); padding: 6px 8px; cursor: pointer;
  transition: background .12s; display: flex; flex-direction: column;
}
.cal-m-cell:hover { background: var(--bg3); }
.cal-m-dimmed { opacity: .35; }
.cal-m-today { background: rgba(139,92,246,.06); }
.cal-m-cell-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-m-day-num { font-size: .78rem; font-weight: 600; color: var(--text); }
.cal-m-today-num {
  background: var(--accent2); color: #fff; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700;
}
.cal-m-hrs { font-size: .62rem; color: var(--text2); font-weight: 600; }
.cal-m-events { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden; }
.cal-m-event {
  border-radius: 4px; padding: 1px 5px; font-size: .65rem; font-weight: 600;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer;
  border-left: 3px solid rgba(0,0,0,0.15);
}
/* Recurring: arrow tiling — month view */
.cal-m-event:not(.cal-oneoff) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='20' viewBox='0 0 10 20'%3E%3Cpath d='M1.5 5h6M5.5 3L8 5 5.5 7' stroke='rgba(0,0,0,0.25)' stroke-width='1.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 20px 20px;
  background-repeat: repeat;
}
.cal-m-event.cal-oneoff {
  border-left: 3px solid rgba(255,255,255,0.35);
}
.cal-m-event-name { pointer-events: none; }
.cal-m-more { font-size: .62rem; color: var(--text2); padding: 1px 4px; font-weight: 600; cursor: pointer; }

/* ── Home 3-day calendar widget ── */
.hw-calendar-widget { cursor: pointer; }
.hw-cal3-title { font-size: .75rem; font-weight: 700; color: var(--text2); margin-bottom: 8px; }
.hw-cal3-wrap { display: flex; gap: 8px; }
.hw-cal3-day {
  flex: 1; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px; padding: 8px; min-height: 60px;
}
.hw-cal3-today { border-color: rgba(139,92,246,.4); background: rgba(139,92,246,.05); }
.hw-cal3-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.hw-cal3-label { font-size: .7rem; font-weight: 700; color: var(--text); }
.hw-cal3-date { font-size: .65rem; color: var(--text2); }
.hw-cal3-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 6px; margin-bottom: 3px; border-radius: 4px;
  background: rgba(255,255,255,.04); font-size: .68rem;
}
.hw-cal3-name { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }
.hw-cal3-hrs { color: var(--text2); font-size: .6rem; flex-shrink: 0; }
.hw-cal3-more { font-size: .6rem; color: var(--accent2); padding: 2px 6px; }
.hw-cal3-empty { font-size: .65rem; color: var(--text2); opacity: .5; padding: 4px 0; }

/* ── Calendar Editing ── */

/* Modals */
.cal-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
/* Force Google Maps autocomplete above modal */
.pac-container { z-index: 10001 !important; }
.cal-modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px 28px; width: 420px; max-width: 92vw; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.cal-modal h3 { margin: 0 0 16px; font-size: 1.1rem; }
.cal-modal label { display: block; margin-bottom: 12px; font-size: .8rem; color: var(--text2); font-weight: 600; }
.cal-modal input, .cal-modal select, .cal-modal textarea {
  width: 100%; padding: 8px 10px; margin-top: 4px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg3); color: var(--text); font-size: .85rem;
  box-sizing: border-box;
}
.cal-modal textarea { resize: vertical; }
.cal-modal-sm { width: 360px; }
.cal-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.cal-modal-actions button {
  padding: 8px 18px; border: none; border-radius: 8px; font-weight: 600;
  cursor: pointer; font-size: .85rem; transition: transform .1s;
}
.cal-modal-actions button:active { transform: scale(.96); }
.btn-primary { background: var(--accent2); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text2); border: 1px solid var(--border) !important; }
.btn-accent { background: #fbbf24; color: #1a1a2e; }
.btn-danger { background: #dc2626; color: #fff; }

/* Autocomplete */
.cal-autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 100;
  background: var(--bg2); border: 1px solid rgba(255,255,255,.15); border-radius: 10px;
  max-height: 220px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.45);
  padding: 4px;
}
.cal-autocomplete-item {
  padding: 10px 12px; cursor: pointer; font-size: .82rem; border-radius: 8px;
  display: flex; flex-direction: column; gap: 2px; transition: background .12s;
}
.cal-autocomplete-item:hover { background: rgba(139,92,246,.12); }
.cal-autocomplete-item .cal-ac-name { color: var(--text); font-weight: 600; }
.cal-autocomplete-item .cal-ac-addr { font-size: .72rem; color: var(--text2); opacity: .7; }

/* One-off & adjusted cards */
.cal-adjusted { background: rgba(139,92,246,.08) !important; }

/* Skip button on cards */
.cal-skip-btn {
  background: none; border: none; cursor: pointer; font-size: .65rem; color: var(--text2);
  opacity: 0; transition: opacity .15s; padding: 0 2px; margin-left: 4px; line-height: 1;
}
.cal-w-card:hover .cal-skip-btn { opacity: .6; }
.cal-skip-btn:hover { opacity: 1 !important; color: #dc2626; }

/* ＋ Add button (inline in header) */
.cal-add-btn {
  margin-left: auto; padding: 0; width: 22px; height: 22px; border: 1px solid var(--border);
  border-radius: 50%; background: transparent; color: var(--text2); font-size: .75rem;
  cursor: pointer; transition: all .15s; display: flex; align-items: center; justify-content: center;
  line-height: 1; flex-shrink: 0;
}
.cal-add-btn:hover { background: rgba(139,92,246,.15); border-color: var(--accent2); color: var(--accent2); }

/* Drag over highlight */
.cal-w-dragover { background: rgba(139,92,246,.08) !important; outline: 2px dashed var(--accent2); outline-offset: -2px; }

/* Past day dimming */
.cal-w-past { opacity: .55; pointer-events: none; }
.cal-w-past .cal-add-btn { display: none; }

/* One-off badge */
.cal-w-oneoff-badge {
  display: inline-block; font-size: .55rem; padding: 1px 4px; border-radius: 3px;
  background: rgba(139,92,246,.2); color: var(--accent2); font-weight: 600; margin-left: 2px;
}
/* Type badge */
.cal-w-type-badge {
  display: inline-block; font-size: .55rem; padding: 1px 4px; border-radius: 3px;
  color: #fff; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-left: 2px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .cal-week-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .cal-week-grid { grid-template-columns: 1fr 1fr; }
  .cal-m-cell { min-height: 60px; }
  .cal-m-event { display: none; }
}

/* ── Context Menu (Admin Tasks) ── */
.at-ctx-menu {
  position: fixed;
  z-index: 9000;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 0;
  min-width: 170px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  display: none;
}
.at-ctx-menu.open { display: block; }
.at-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: .82rem;
  color: var(--text);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .1s;
}
.at-ctx-item:hover { background: rgba(255,255,255,.07); }
.at-ctx-item.danger { color: #f87171; }
.at-ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Deadline quick-pick buttons ── */
.at-deadline-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}
.at-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  font-size: .75rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.at-dl-btn:hover, .at-dl-btn.active {
  background: rgba(139,92,246,.2);
  border-color: rgba(139,92,246,.4);
  color: #a78bfa;
}
.at-dl-btn.clear-btn:hover {
  background: rgba(248,113,113,.15);
  border-color: rgba(248,113,113,.3);
  color: #f87171;
}
.at-dl-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
}
.at-dl-pill.future { background: rgba(139,92,246,.15); color: #a78bfa; border: 1px solid rgba(139,92,246,.25); }
.at-dl-pill.today  { background: rgba(251,191,36,.15);  color: #fbbf24; border: 1px solid rgba(251,191,36,.25); }
.at-dl-pill.past   { background: rgba(248,113,113,.15); color: #f87171; border: 1px solid rgba(248,113,113,.25); }

/* ── Mini calendar date input popup ── */
.at-date-picker-popup {
  position: fixed;
  z-index: 10100;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  display: none;
}
.at-date-picker-popup.open { display: block; }
.at-date-picker-popup input[type="date"] {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 6px 10px;
  font-size: .85rem;
  cursor: pointer;
}

/* ── Mini Calendar Popup ── */
/* Mini cal inside duplicate event modal — full width, inline */
.cal-dup-mini-cal-wrap .at-mini-cal { width: 100%; }
.cal-dup-mini-cal-wrap .at-mini-cal-grid { gap: 2px; }
.cal-dup-mini-cal-wrap .at-cal-day { padding: 7px 0; font-size: .82rem; }

.at-mini-cal { width: 224px; user-select: none; }
.at-mini-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.at-mini-cal-title {
  font-size: .83rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .02em;
}
.at-cal-nav {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 3px 7px;
  border-radius: 6px;
  line-height: 1;
  transition: background .12s;
}
.at-cal-nav:hover { background: rgba(255,255,255,.09); }
.at-mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.at-cal-dow {
  text-align: center;
  font-size: .66rem;
  color: var(--text2);
  padding: 3px 0 5px;
  font-weight: 600;
  text-transform: uppercase;
}
.at-cal-day {
  text-align: center;
  font-size: .78rem;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  transition: background .1s, color .1s;
}
.at-cal-day:hover { background: rgba(255,255,255,.1); }
.at-cal-empty { cursor: default; pointer-events: none; }
.at-cal-today {
  background: rgba(139,92,246,.18);
  color: #a78bfa;
  font-weight: 700;
}
.at-cal-selected {
  background: #8b5cf6 !important;
  color: #fff !important;
  font-weight: 700;
}
.at-mini-cal-footer {
  margin-top: 10px;
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.at-cal-clear-btn {
  background: none;
  border: none;
  color: #f87171;
  font-size: .75rem;
  cursor: pointer;
  padding: 0;
}
.at-cal-clear-btn:hover { text-decoration: underline; }

/* ── Tech selection dropdown ── */
.tkan-dropdown { position: relative; }
.tkan-dropdown-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: .85rem;
  cursor: pointer; gap: 8px; user-select: none;
}
.tkan-dropdown-trigger:hover { border-color: rgba(139,92,246,.5); }
.tkan-dropdown-arrow { font-size: .7rem; color: var(--text2); }
.tkan-dropdown-list {
  position: absolute; left: 0; right: 0; z-index: 50;
  max-height: 200px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg3); margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

/* ── Tech selection list hover ── */
.at-tech-opt:hover,
.deleg-tech-opt:hover,
.ptask-edit-tech-opt:hover,
.tkan-tech-opt:hover { background: rgba(139,92,246,.08) !important; }
.at-tech-opt-selected,
.deleg-tech-opt-selected,
.ptask-edit-tech-sel,
.tkan-tech-sel { background: rgba(139,92,246,.15) !important; }

/* ═══════════════════════════════════════════════════════════
   AUDIT LOG & ERROR LOG TABLES
   ═══════════════════════════════════════════════════════════ */
.al-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.al-filter-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: .82rem;
  padding: 6px 10px;
  cursor: pointer;
}
.al-filter-select:focus { outline: none; border-color: var(--accent2); }
.al-count {
  font-size: .78rem;
  color: var(--text2);
  margin-left: auto;
}
.al-table-wrap {
  overflow-x: auto;
  padding: 0 20px 24px;
}
.al-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
  margin-top: 10px;
}
.al-th {
  text-align: left;
  color: var(--text2);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.al-td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
  color: var(--text);
}
.al-table tbody tr:hover td { background: rgba(255,255,255,.025); }
.al-time  { white-space: nowrap; color: var(--text2); width: 130px; }
.al-user  { width: 120px; font-weight: 500; }
.al-action { width: 200px; }
.al-detail { color: var(--text2); }
.al-context { width: 160px; font-family: monospace; font-size: .78rem; color: #fbbf24; }
.al-msg   { color: #f87171; }
.al-page  { width: 140px; }

/* Error row expand */
.el-row { cursor: pointer; }
.el-row:hover td { background: rgba(248,113,113,.06) !important; }
.el-stack-row td { background: rgba(0,0,0,.3); }
.el-stack {
  font-family: monospace;
  font-size: .72rem;
  color: var(--text2);
  padding: 12px 16px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS DASHBOARD
   ═══════════════════════════════════════════════════════════ */
.sdash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.sdash-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.sdash-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139,92,246,.4);
  box-shadow: 0 6px 24px rgba(139,92,246,.12);
}
.sdash-card-accent { border-left: 3px solid var(--accent2); }
.sdash-card-warn   { border-left: 3px solid #f87171; }
.sdash-card-ok     { border-left: 3px solid #4ade80; }

.sdash-card-icon { font-size: 1.6rem; }
.sdash-card-info { display: flex; align-items: baseline; gap: 10px; }
.sdash-card-number {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
.sdash-card-label {
  font-size: .82rem;
  color: var(--text2);
  font-weight: 500;
}
.sdash-card-desc {
  font-size: .76rem;
  color: var(--text2);
  line-height: 1.45;
}

/* Sections */
.sdash-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}
.sdash-section {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
}
.sdash-section-title {
  font-size: .92rem;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--text);
}
.sdash-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sdash-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sdash-info-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
}
.sdash-info-value {
  font-size: .84rem;
  color: var(--text);
  font-weight: 500;
}

/* Nav cards */
.sdash-nav-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sdash-nav-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background .1s, border-color .15s;
}
.sdash-nav-card:hover {
  background: rgba(139,92,246,.06);
  border-color: rgba(139,92,246,.3);
}
.sdash-nav-icon { font-size: 1.2rem; margin-top: 1px; }
.sdash-nav-card strong { font-size: .82rem; color: var(--text); }
.sdash-nav-desc { font-size: .72rem; color: var(--text2); line-height: 1.4; }

/* ═══════════════════════════════════════════════════════════
   PROJECT APP STORE — PHASE 1
   Mobile Responsive Styles
   Breakpoints: 768px (tablets/phones) · 480px (small phones)
   ═══════════════════════════════════════════════════════════ */

/* ── Safe area insets (iPhone notch / Dynamic Island / home bar) */
:root {
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

@media (max-width: 768px) {

  /* ── TOP NAV ── */
  .top-nav {
    padding: 0 12px 0 12px;
    padding-top: var(--safe-top);
    height: calc(var(--top-nav-h) + var(--safe-top));
  }

  /* Shrink the big BEBAS NEUE logo on small screens */
  .logo-text {
    font-size: 1.8rem;
  }

  /* Keep tab title readable but smaller */
  .tab-title-btn {
    font-size: .85rem;
    padding: 7px 12px 7px 14px;
  }

  /* ── NAV MEGA-MENU ── */
  /* On mobile: full-width panel pinned to top, not 540px floating */
  .nav-dropdown {
    width: calc(100vw - 24px);
    left: 12px;
    right: 12px;
    transform: translateY(-10px);
    border-radius: 16px;
  }
  .nav-dropdown.open {
    transform: translateY(0);
  }

  /* 3-col grid → 2-col */
  .nav-mega-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  /* Hide the vertical dividers between columns on mobile */
  .nav-col-divider {
    display: none;
  }

  /* ── MAIN CONTENT ── */
  .main-content {
    padding-left: 16px;
    padding-right: 16px;
    padding-top: calc(var(--top-nav-h) + var(--safe-top) + 12px);
    padding-bottom: calc(20px + var(--safe-bottom));
    /* Lock to viewport height — makes main-content the scroll container,
       not body. No child tab can ever expand body scrollHeight beyond
       the viewport, eliminating the ghost scroll space on all tabs. */
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    box-sizing: border-box;
  }

  /* ── PAGE HEADERS ── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-header h1 {
    font-size: 1.3rem;
  }

  /* ── CLIENTS TABLE ── */
  /* Wrap in scrollable container — table still reads as table */
  .clients-table-wrap,
  .accounts-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  .clients-inner-table {
    min-width: 700px; /* reduced from 1100px */
  }

  /* ── HOME VIEW ── */
  /* Stats overview: wrap from 4-col to 2-col */
  .overview-grid,
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }

  /* Home widgets: stack vertically */
  .home-widgets-row,
  .hw-row {
    flex-direction: column;
    gap: 12px;
  }
  .home-widget {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Home cards grid: 1 column */
  .home-cards-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── SETTINGS DASHBOARD ── */
  .sdash-cards {
    grid-template-columns: 1fr;
  }
  .sdash-sections {
    grid-template-columns: 1fr;
  }
  .sdash-info-grid {
    grid-template-columns: 1fr;
  }

  /* ── TAB BARS (Settings, Data) ── */
  /* Horizontally scrollable pill strip — no wrapping */
  .settings-tabs,
  .data-subtab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    /* Hide scrollbar visually but keep scrollable */
    scrollbar-width: none;
  }
  .settings-tabs::-webkit-scrollbar,
  .data-subtab-bar::-webkit-scrollbar {
    display: none;
  }
  .settings-tab,
  .data-subtab {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* ── KANBAN / REPLACEMENTS BOARD ── */
  /* Horizontal scroll with snap — each column is phone-width */
  .kanban-board,
  .tasks-kanban {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    display: flex !important;
    flex-wrap: nowrap !important;
    padding-bottom: 12px;
  }
  .kanban-col {
    scroll-snap-align: start;
    min-width: calc(100vw - 48px);
    flex-shrink: 0;
  }

  /* ── MODALS ── */
  /* Bottom sheet style on mobile */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #modal-body,
  .modal-body {
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
    width: 100% !important;
    max-width: 100% !important;
    padding-bottom: calc(24px + var(--safe-bottom));
  }

  /* Client modal specifically */
  #client-modal-overlay .modal-inner,
  .modal-form {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
  }

  /* ── BUTTONS ── */
  /* Ensure tap targets are at least 44px tall (Apple HIG guideline) */
  .btn {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .btn-sm {
    min-height: 36px;
  }


  /* ── REP LIST TABLE — horizontal scroll ── */

  /* Board is the single scroll container. overflow-y: hidden severs iOS vertical-scroll
     chaining; overscroll-behavior-x: contain stops edge-bounce handing off to a parent.
     max-height + overflow: clip ensures the table height never bleeds into main-content
     and creates extra scroll space on other tabs. */
  #replacements-board {
    overflow-x: auto;
    overflow-y: clip;          /* clip — unlike hidden, does not create a scroll container */
    max-height: calc(100dvh - var(--top-nav-h) - var(--safe-top) - 80px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  /* The filter bar and table must be at least as wide as their natural content so the
     board scroll range covers the full width — no artificial 520px cap. */
  .rep-list-filters,
  .rep-list-table {
    min-width: max-content;
  }

  .rep-list-table {
    overflow-x: visible; /* parent board scrolls */
    border-radius: 10px;
  }

  /* Rows must never wrap — inline widths on each span drive the layout */
  .rep-list-hdr,
  .rep-list-row {
    flex-wrap: nowrap;
  }



  /* ── P&L / SALARIES TABLE ── */
  .sal-table-wrap,
  .pnl-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── MAP VIEW ── */
  /* Map search bar: full width on mobile */
  .map-search-bar {
    width: calc(100% - 32px) !important;
    left: 16px !important;
    right: 16px !important;
  }

  /* ── CHAT PANEL ── */
  /* Full width on mobile instead of sliding panel */
  .chat-panel-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ── ADMIN TASKS ── */
  .admin-tasks-header {
    flex-direction: column;
    gap: 10px;
  }
  .admin-tasks-header > * {
    width: 100%;
  }

  /* ── FORM COLUMNS ── */
  /* Two-column form layouts → single column */
  .form-row-2col,
  .form-grid-2 {
    grid-template-columns: 1fr !important;
  }

  /* ── NOTIFICATION BELL PANEL ── */
  .notif-panel {
    width: calc(100vw - 24px) !important;
    right: 12px !important;
    left: 12px !important;
  }

} /* end @media 768px */


@media (max-width: 480px) {

  /* Extra small phones (iPhone SE etc.) */

  .logo-text {
    font-size: 1.5rem;
  }

  .tab-title-btn {
    font-size: .78rem;
    padding: 6px 10px 6px 12px;
  }

  .page-header h1 {
    font-size: 1.15rem;
  }

  /* Stats: 2-col stays but smaller text */
  .stat-value {
    font-size: 1.4rem !important;
  }

  /* Kanban columns: fully full-width */
  .kanban-col {
    min-width: calc(100vw - 32px);
  }

  /* Settings nav cards: hide description text to save space */
  .sdash-nav-desc {
    display: none;
  }

  /* Modal: full height */
  #modal-body,
  .modal-body {
    max-height: 95vh;
  }

} /* end @media 480px */


/* ═══════════════════════════════════════════════════════════
   PROJECT APP STORE — PHASE 1B
   Mobile UX Pass
   ═══════════════════════════════════════════════════════════ */

/* ── Fix 1: Body scroll lock when modal is open ── */
/* body.modal-open — MOBILE ONLY. On desktop just hide overflow */
@media (max-width: 768px) {
  body.modal-open {
    overflow: hidden;
    /* Use touch-action instead of position:fixed to avoid layout reset */
    touch-action: none;
  }
}


@media (max-width: 768px) {

  /* ── Fix 1: Client modal — fixed-height shell ── */
  #client-modal-overlay.open {
    align-items: flex-end;
    padding: 0;
  }

  #client-modal {
    border-radius: 22px 22px 0 0;
    max-width: 100%;
    width: 100%;
    /* Fixed height: header + tabs always visible, content scrolls */
    height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUpSheet .22s cubic-bezier(.4,0,.2,1);
  }

  /* Drag indicator bar at top of bottom sheet */
  #client-modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,.2);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }

  #client-modal .modal-header {
    flex-shrink: 0;
    padding: 12px 18px;
  }

  #client-modal .modal-tabs {
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    border-bottom: 1px solid var(--border);
  }
  #client-modal .modal-tabs::-webkit-scrollbar { display: none; }
  #client-modal .modal-tab { flex-shrink: 0; }

  /* Each tab body fills remaining vertical space and scrolls */
  #client-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(24px + var(--safe-bottom));
  }

  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* ── Fix 2 & 3: Team Members — compact rows on mobile ── */

  /* Hide the dense desktop elements in card view */
  .tuc-card .tuc-color-row,
  .tuc-card .tuc-actions {
    display: none;
  }

  /* Make each card a tappable row */
  .tuc-card {
    cursor: pointer;
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    gap: 0;
    position: relative;
  }
  .tuc-card::after {
    content: '›';
    position: absolute;
    right: 16px;
    font-size: 1.3rem;
    color: var(--text2);
    opacity: .5;
  }
  .tuc-identity {
    flex: 1;
    min-width: 0;
  }

  /* ── Tech Detail Bottom Sheet ── */
  #tech-detail-sheet {
    position: fixed;
    inset: 0;
    z-index: 9600;
    display: none;
  }
  #tech-detail-sheet.open {
    display: block;
  }
  #tech-detail-sheet .tds-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
  }
  #tech-detail-sheet .tds-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg2);
    border-radius: 22px 22px 0 0;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    animation: slideUpSheet .22s cubic-bezier(.4,0,.2,1);
    padding-bottom: var(--safe-bottom);
  }
  #tech-detail-sheet .tds-drag-bar {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,.2);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }
  #tech-detail-sheet .tds-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
  }
  #tech-detail-sheet .tds-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
  }
  #tech-detail-sheet .tds-close {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 1.2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }
  #tech-detail-sheet .tds-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px 18px;
  }
  .tds-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
  }
  .tds-info-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
  }
  .tds-info-meta {
    font-size: .8rem;
    color: var(--text2);
    margin-top: 2px;
  }
  .tds-section-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text2);
    margin-bottom: 10px;
  }

  /* Fix 3: Color picker in detail sheet */
  .tds-color-wrap {
    margin-bottom: 20px;
  }
  .tds-color-current {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
  }
  .tds-color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.25);
    flex-shrink: 0;
  }
  .tds-color-label {
    flex: 1;
    font-size: .82rem;
    color: var(--text2);
  }
  .tds-color-chevron {
    font-size: .7rem;
    color: var(--text2);
    transition: transform .15s;
  }
  .tds-color-wrap.expanded .tds-color-chevron {
    transform: rotate(180deg);
  }
  .tds-swatches {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
  }
  .tds-color-wrap.expanded .tds-swatches {
    display: flex;
  }
  .tds-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform .1s, border-color .1s, box-shadow .1s;
  }
  .tds-swatch:active { transform: scale(.9); }
  .tds-swatch.active {
    border-color: rgba(255,255,255,.7);
    transform: scale(1.1);
  }
  /* Whitewashed (pastel) swatches — dark active state */
  .tds-swatch--wash {
    border-color: rgba(0,0,0,.08);
  }
  .tds-swatch--wash.active {
    border-color: rgba(0,0,0,.4);
    box-shadow: 0 0 0 2px rgba(0,0,0,.15);
  }

  /* Action buttons in detail sheet */
  .tds-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .tds-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* ── Fix 4 & 5: Kanban → Tab navigation on mobile ── */

  /* Reset the at-board overflow so the tab bar isn't clipped */
  .at-board {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  /* admin-tasks-board fills remaining space; height is auto within main-content scroll container.
     overflow: clip was removed — it was clipping the position:fixed FAB on iOS WebKit. */
  #admin-tasks-board {
    height: auto;
    min-height: 0;
  }

  .mobile-tasks-tabs-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
  }
  .mobile-tasks-tab-bar {
    display: flex;
    overflow-x: hidden;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    padding: 0;
    gap: 0;
  }
  .mobile-tasks-tab-bar::-webkit-scrollbar { display: none; }
  .mobile-tasks-tab-btn {
    flex: 1;                  /* fill bar edge to edge */
    background: none;
    border: none;
    color: var(--text2);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 500;
    padding: 10px 4px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
    text-align: center;
  }
  .mobile-tasks-tab-btn.active {
    color: var(--accent2);
    border-bottom-color: var(--accent2);
    font-weight: 700;
  }
  .mobile-tasks-col-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* 16px on both sides matches the main-content inset, giving equal breathing room */
    padding: 12px 16px calc(20px + var(--safe-bottom));
  }

  /* ── Scroll-snap column container ── */
  .at-mobile-cols-scroll {
    display: flex;
    flex: 1;
    width: 100%;           /* panels use width:100% — needs explicit parent width to resolve */
    min-height: 0;         /* allow flex child to shrink below its content height */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .at-mobile-cols-scroll::-webkit-scrollbar { display: none; }

  .at-mobile-col-panel {
    scroll-snap-align: start;
    flex-shrink: 0;
    width: 100%;
    min-width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 12px 16px calc(90px + var(--safe-bottom));
    box-sizing: border-box;
  }

} /* end @media 768px */


/* ═══════════════════════════════════════════════════════════
   PROJECT APP STORE — PHASE 1B (Round 2)
   Targeted mobile fixes from user feedback
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Fix: Nav logo — more left padding, smaller text so dropdown doesn't collide ── */
  .top-nav {
    padding-left: 4px;
    padding-right: 8px;
  }
  .top-nav-logo {
    padding: 6px 6px;
    gap: 6px;
  }
  .logo-text {
    font-size: 1.4rem;
    letter-spacing: .03em;
  }

  /* ── Fix: P&L pills in client modal — stack vertically, no horizontal overflow ── */
  .pnl-strip {
    flex-direction: column;
    gap: 8px;
  }
  .pnl-box {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
  }

  /* ── Fix: Client modal — no horizontal scroll, single-column form ── */
  #client-modal {
    overflow-x: hidden;
  }
  #client-modal .modal-body {
    overflow-x: hidden;
  }
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  /* Keep full-width fields spanning properly in single-column */
  .form-group-full {
    grid-column: 1;
  }

  /* ── Fix: Task modals (both admin + tech tasks) — fixed header, scrollable body ── */
  #admin-task-modal-overlay,
  #task-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  #admin-task-modal,
  #task-modal {
    border-radius: 22px 22px 0 0;
    max-width: 100% !important;
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    animation: slideUpSheet .22s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
  }
  #admin-task-modal::before,
  #task-modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,.2);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }
  #admin-task-modal .modal-header,
  #task-modal .modal-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg2);
  }
  /* Task modal body — scrolls only inside, header stays pinned */
  #admin-task-modal-body,
  #task-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(24px + var(--safe-bottom));
  }
  /* modal-form inside admin task — no fixed max-width on mobile */
  #admin-task-modal-body .modal-form {
    max-width: 100% !important;
  }

  /* Body scroll lock when task modals open */
  #admin-task-modal-overlay[style*="flex"],
  #task-modal-overlay.open {
    /* Handled via JS body.modal-open class */
  }

  /* ── Fix: Team Members — Add form row should wrap on mobile ── */
  .tuc-add-form .form-row {
    flex-direction: column;
    gap: 10px;
  }
  .tuc-add-form .form-row input {
    width: 100%;
  }
  .tuc-add-form .form-row .btn {
    width: 100%;
    justify-content: center;
  }

  /* ── Fix: Body overscroll on Team Members list ── */
  #view-technicians {
    overscroll-behavior-y: none;
  }

  /* ── Fix: Task image upload button on mobile (visible tap target) ── */
  .task-image-upload-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg3);
    border: 1px dashed var(--border2);
    border-radius: 8px;
    color: var(--text2);
    font-family: inherit;
    font-size: .82rem;
    padding: 10px 14px;
    cursor: pointer;
    width: 100%;
    margin-top: 6px;
    transition: background var(--trans);
  }
  .task-image-upload-btn:active {
    background: var(--surface2);
  }

} /* end @media 768px */

/* ═══════════════════════════════════════════════════════════
   RICH TEXT EDITOR — Notes Component
   ═══════════════════════════════════════════════════════════ */
.re-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg3);
  transition: border-color 0.15s;
}
.re-wrap:focus-within {
  border-color: var(--accent);
}
.re-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: var(--surface2, rgba(255,255,255,.04));
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.re-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--text2);
  font-family: inherit; font-size: 0.78rem;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.re-btn:hover { background: rgba(139,92,246,.12); color: var(--text); }
.re-btn.re-active { background: rgba(139,92,246,.22); color: var(--accent); }
.re-sep {
  width: 1px; height: 18px;
  background: var(--border); margin: 0 4px;
}
.re-body {
  min-height: 80px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.55;
  outline: none;
  -webkit-overflow-scrolling: touch;
}
.re-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text2);
  opacity: 0.55;
  pointer-events: none;
}
.re-body ul, .re-body ol {
  margin: 4px 0; padding-left: 20px;
}
.re-body li { margin-bottom: 2px; }

/* Calendar event detail — stacked notes display */
.cal-evd-notes-row {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.cal-evd-notes-body {
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.55;
  margin-top: 4px;
  padding-left: 2px;
}
.cal-evd-notes-body ul, .cal-evd-notes-body ol {
  margin: 4px 0; padding-left: 18px;
}
.cal-evd-notes-body li { margin-bottom: 2px; }
.cal-evd-notes-body b, .cal-evd-notes-body strong { font-weight: 700; }
.cal-evd-notes-body i, .cal-evd-notes-body em { font-style: italic; }
.cal-evd-notes-body u { text-decoration: underline; }

/* ── Event detail three-dot menu ── */
.cal-evd-dots-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 1.2rem;
  line-height: 1;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s;
  flex-shrink: 0;
  letter-spacing: 1px;
}
.cal-evd-dots-btn:hover {
  background: rgba(139,92,246,.18);
  color: var(--text);
}
.cal-evd-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
  animation: fadeIn .12s ease;
}
.cal-evd-dd-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: .87rem;
  padding: 11px 14px; cursor: pointer;
  transition: background .1s;
}
.cal-evd-dd-item:last-child { border-bottom: none; }
.cal-evd-dd-item:hover { background: rgba(255,255,255,.06); }
.cal-evd-dd-danger { color: var(--danger, #ef4444); }
.cal-evd-dd-danger:hover { background: rgba(239,68,68,.1); }



/* ═══════════════════════════════════════════════════════════
   PROJECT APP STORE — PHASE 1B (Round 3)
   ═══════════════════════════════════════════════════════════ */

/* ── Fix: Tech detail sheet ALWAYS hidden on desktop ── */
#tech-detail-sheet {
  display: none;
}
#tech-detail-sheet.open {
  display: block;
}

/* ── Fix: iOS auto-zoom prevention — all modal inputs must be ≥16px ── */
@media (max-width: 768px) {
  #client-modal input,
  #client-modal select,
  #client-modal textarea,
  #task-modal input,
  #task-modal select,
  #task-modal textarea,
  #admin-task-modal input,
  #admin-task-modal select,
  #admin-task-modal textarea {
    font-size: 16px !important;
  }

  /* ── Fix: Clients page — P&L pills above search bar on mobile ── */
  #view-clients .search-bar-wrap {
    order: 2;
    margin-top: 12px;
  }
  #clients-pnl {
    order: 1;
  }
  /* Make the section a flex column so order works */
  #view-clients > section,
  #view-clients .main-content > section {
    display: flex;
    flex-direction: column;
  }
  /* Keep page-header (title + Add Client button) at top */
  #view-clients .page-header {
    order: 0;
  }
  /* Table below search */
  #view-clients .table-wrap {
    order: 3;
  }

  /* ── Fix: Remove empty ruleset warning cleanup ── */
  #admin-task-modal-overlay[style*="flex"],
  #task-modal-overlay.open { opacity: 1; } /* non-empty placeholder */
}

/* ═══════════════════════════════════════════════════════════
   CLIENTS TAB — Mobile Polish
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Only apply flex layout when the clients view is actually visible */
  #view-clients.active {
    display: flex;
    flex-direction: column;
  }
  #view-clients .page-header  { order: 0; }
  #view-clients #clients-pnl  { order: 1; margin-bottom: 0; }
  #view-clients .search-bar-wrap { order: 2; margin-top: 10px; }
  #view-clients .table-wrap   { order: 3; }

  /* ── Button row: emoji icons left, Add Client right ── */
  #clients-header-btns {
    width: 100%;
    flex-wrap: nowrap !important;
  }

  /* Hide text labels on Template & Import — show emoji only */
  #clients-template-btn .btn-label,
  #clients-import-btn .btn-label {
    display: none;
  }
  #clients-template-btn,
  #clients-import-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1.2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Push Add Client to the far right */
  #clients-add-btn {
    margin-left: auto;
    flex-shrink: 0;
  }

  /* ── Bulk Action button: hide on mobile (not useful without hover) ── */
  #bulk-action-btn {
    display: none;
  }

  /* ── P&L strip: ensure no horizontal overflow ── */
  #clients-pnl.pnl-strip {
    overflow-x: hidden;
  }

} /* end clients tab mobile */

/* ═══════════════════════════════════════════════════════════
   CLIENT MODAL — X button + footer row
   ═══════════════════════════════════════════════════════════ */

/* ── Client modal footer: Cancel left, Save right ── */
.client-modal-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.client-modal-footer .btn {
  flex: 1;
  max-width: 48%;
}

/* ── Client modal close (✕) — red and larger on all screen sizes ── */
#client-modal .modal-close {
  color: #ff4d4f;
  font-size: 1.35rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, transform 0.1s;
}
#client-modal .modal-close:hover {
  background: rgba(255, 77, 79, 0.15);
  transform: scale(1.1);
}

/* ═══════════════════════════════════════════════════════════
   CLIENT MODAL — Bigger X + even tabs
   ═══════════════════════════════════════════════════════════ */

/* ── Bigger X button ── */
#client-modal .modal-close {
  color: #ff4d4f;
  font-size: 1.65rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, transform 0.1s;
}
#client-modal .modal-close:hover {
  background: rgba(255, 77, 79, 0.15);
  transform: scale(1.1);
}

/* ── Modal tabs: evenly spaced, compact, scrollable ── */
#client-modal .modal-tabs {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  gap: 0;
}
#client-modal .modal-tabs::-webkit-scrollbar { display: none; }

#client-modal .modal-tab {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
  padding: 8px 6px;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Client modal tabs: taller vertical height ── */
#client-modal .modal-tab {
  padding-top: 16px;
  padding-bottom: 16px;
}

/* ── Prevent iOS auto-zoom on search input tap ── */
@media (max-width: 768px) {
  #client-search {
    font-size: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════
   ACCOUNTS WEEKLY — Custom autocomplete + mobile fixes
   ═══════════════════════════════════════════════════════════ */

/* Custom suggestion dropdown */
.aw-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 200;
  overflow: hidden;
}
.aw-suggestion-item {
  padding: 11px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text1);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.aw-suggestion-item:last-child { border-bottom: none; }
.aw-suggestion-item:active,
.aw-suggestion-item:hover { background: var(--accent-soft, rgba(99,102,241,0.12)); }

@media (max-width: 768px) {
  /* Prevent iOS zoom on Accounts Weekly search input */
  #aw-search-input {
    font-size: 16px;
  }

  /* Hide Test Route button on mobile */
  #test-planner-btn {
    display: none !important;
  }
}

/* ── Map tab: prevent iOS auto-zoom on input tap ── */
@media (max-width: 768px) {
  #map-client-search,
  #map-address-input {
    font-size: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE CALENDAR — Google Calendar-style
   ═══════════════════════════════════════════════════════════ */

/* ── Hide mobile elements on desktop ── */
/* Hide mobile elements by default (desktop first) */
.cal-mobile-topbar,
.cal-mobile-body,
.cal-drawer-overlay,
.cal-drawer { display: none; }

@media (max-width: 768px) {

  /* ── Hide desktop layout on mobile ── */
  .cal-desktop-layout { display: none !important; }

  /* ── Show mobile body ── */
  .cal-mobile-body {
    display: block;
    height: calc(100vh - 110px); /* fallback */
    height: calc(100dvh - 110px); /* accounts for mobile browser chrome */
    overflow: hidden;
  }

  /* ═══ MOBILE TOP BAR ═══ */
  .cal-mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .cal-hamburger {
    background: none; border: none;
    font-size: 1.5rem; color: var(--text);
    padding: 6px; cursor: pointer;
    line-height: 1;
  }
  .cal-mobile-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
    text-align: center;
  }
  .cal-mobile-today {
    background: none; border: 1px solid var(--border);
    color: var(--accent2);
    font-size: 0.78rem; font-weight: 600;
    padding: 4px 12px;
    border-radius: 16px;
    cursor: pointer;
  }
  .cal-mobile-today:active { background: rgba(139,92,246,.12); }

  /* ── Mobile search toggle ── */
  .cal-mobile-search-btn { display: block; }
  .cal-mobile-search-bar { position: relative; }
  .cal-mobile-search-bar .cal-search-input-wrap { flex: 1; }
  .cal-mobile-search-bar .cal-search-input { font-size: 16px; /* prevent iOS zoom */ }

  /* ═══ DRAWER ═══ */
  .cal-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s;
  }
  .cal-drawer-overlay.open {
    display: block;
    opacity: 1;
  }
  .cal-drawer {
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 32px;
  }
  .cal-drawer.open {
    transform: translateX(0);
  }
  .cal-drawer-header {
    padding: 20px 20px 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
  }
  .cal-drawer-section {
    padding: 16px 16px 8px;
  }
  .cal-drawer-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text2);
    margin-bottom: 8px;
  }

  /* ── Drawer view toggle ── */
  .cal-drawer-view-toggle {
    display: flex; gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
  }
  .cal-dv-btn {
    flex: 1;
    padding: 10px;
    font-size: 0.85rem; font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text2);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .cal-dv-btn.active {
    background: var(--accent2);
    color: #fff;
  }

  /* ── Drawer filter items ── */
  .cal-drawer-filter-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none; border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
  }
  .cal-drawer-filter-item.active { font-weight: 600; }
  .cal-drawer-filter-item:active { background: rgba(139,92,246,.08); }
  /* Group row: expand button + select-all pill */
  .cal-drawer-role-row {
    display: flex; align-items: center;
    border-bottom: 1px solid var(--border);
  }
  .cal-drawer-role-row .cal-drawer-filter-item {
    flex: 1; border-bottom: none;
  }
  .cal-df-group-toggle {
    flex-shrink: 0;
    margin-right: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1.5px solid;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
  }
  .cal-df-dot {
    width: 10px; height: 10px;
    border-radius: 50; flex-shrink: 0;
  }
  .cal-df-check {
    width: 18px; text-align: center;
    color: var(--accent2); font-weight: 700;
  }
  .cal-df-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text2);
  }
  .cal-df-summary {
    padding: 4px 14px 8px 42px;
    display: flex; gap: 6px; flex-wrap: wrap;
  }
  .cal-df-active-name {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,.06);
  }
  .cal-df-members {
    padding: 0 8px 8px 28px;
  }
  .cal-df-member {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 9px 10px;
    background: transparent;
    border: none; border-bottom: 1px solid rgba(255,255,255,.05);
    color: var(--text2);
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
  }
  .cal-df-member.active { color: var(--text); font-weight: 600; }
  .cal-df-member:active { background: rgba(139,92,246,.08); }
  .cal-df-member-dot {
    width: 8px; height: 8px;
    border-radius: 50%; flex-shrink: 0;
  }

  /* ═══ MOBILE WEEK TIME GRID ═══ */
  .cmw-grid-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
  .cmw-header {
    display: grid;
    grid-template-columns: 40px repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
    position: sticky; top: 0; z-index: 5;
  }
  .cmw-corner { /* empty */ }
  .cmw-day-header {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 6px 0;
    font-size: 0.65rem;
    color: var(--text2);
  }
  .cmw-day-letter {
    font-size: 0.6rem; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .cmw-day-num {
    font-size: 0.85rem; font-weight: 700;
    color: var(--text);
    margin-top: 1px;
  }
  .cmw-today { background: rgba(139,92,246,.06); }
  .cmw-today-num {
    background: var(--accent2);
    color: #fff;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
  }

  /* ── Time body (scrollable) ── */
  .cmw-body {
    flex: 1;
    overflow-y: scroll; /* force scroll even on iOS */
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y; /* allow vertical finger scroll */
    position: relative;
  }
  .cmw-row {
    display: grid;
    grid-template-columns: 40px repeat(7, 1fr);
    min-height: 48px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    box-sizing: border-box;
  }
  .cmw-time-label {
    font-size: 0.55rem;
    color: var(--text2);
    padding: 2px 4px 0 0;
    text-align: right;
    line-height: 1;
  }
  .cmw-cell {
    border-left: 1px solid rgba(255,255,255,.04);
    min-height: 48px;
    cursor: pointer;
  }
  .cmw-cell:active { background: rgba(139,92,246,.08); }

  /* ── Event blocks (absolute within body) ── */
  .cmw-event {
    position: absolute;
    border-radius: 4px;
    padding: 2px 3px;
    overflow: hidden;
    cursor: pointer;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-height: 20px;
    transition: opacity 0.15s;
  }
  .cmw-event:active { opacity: 0.7; }
  .cmw-event-title {
    display: none;
  }

  /* ═══ THREAD OPEN — iMessage layout ═══ */

  /* 1. Hide the hub bar entirely */
  body.mobile-thread-open .top-nav {
    display: none !important;
  }
  /* 2. Lock page scroll so it can't bleed through */
  body.mobile-thread-open {
    overflow: hidden !important;
  }

  /* 3. Panel: true full-screen fixed, flex column */
  .chats-main { display: none !important; }

  body.mobile-thread-open #chats-main {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999 !important;
    background: var(--bg) !important;
    overflow: hidden !important;
  }

  /* 4. Header: absolute, floats over messages so they scroll behind it */
  body.mobile-thread-open .chats-thread-header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-top: max(env(safe-area-inset-top, 0px), 14px) !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: 12px !important;
    gap: 10px !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: none !important;
  }

  /* ════════════════════════════════════════════════════════════════════════════
   MOBILE ADMIN TASKS — Plant×App FAB (comet pulse in the ring)
   ════════════════════════════════════════════════════════════════════════════ */

.at-mobile-fab-wrap {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  z-index: 1200;
  pointer-events: none;
  transition: opacity .2s;
}
.at-mobile-fab-wrap > * { pointer-events: auto; }

/* Ring shell — dim track + drop shadow */
.at-fab-ring-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* Dim base track */
  box-shadow:
    0 0 0 2px rgba(149,213,178,0.14),
    0 6px 28px rgba(0,0,0,.60);
}

/* Spinning conic comet — visible only through the 5px ring mask */
.at-fab-ring-wrap::before {
  content: '';
  position: absolute;
  inset: -5px;               /* extends 5px outside the 68px disc */
  border-radius: 50%;
  /* Comet gradient: most of circle is dim, one arc blazes bright */
  background: conic-gradient(
    from 0deg,
    rgba(149,213,178,0.05)  0deg,
    rgba(149,213,178,0.05)  180deg,
    rgba(149,213,178,0.22)  230deg,
    rgba(167,139,250,0.55)  268deg,
    rgba(149,213,178,0.88)  305deg,
    rgba(220,255,240,0.98)  330deg,  /* white-hot peak */
    rgba(149,213,178,0.50)  348deg,
    rgba(149,213,178,0.05)  360deg
  );
  animation: at-orb-spin 2.6s linear infinite;
  /* Hollow out the interior — show ONLY the ring border */
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent  calc(100% - 5px),
    white        calc(100% - 5px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent  calc(100% - 5px),
    white        calc(100% - 5px)
  );
  pointer-events: none;
  z-index: 0;
}

/* Dark disc button — static, always above the ring pseudo-element */
.at-fab-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #12121e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: background .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.at-fab-btn:active {
  background: #1a1a30;
  transform: scale(0.91);
}

/* Plus icon — plant×app colors, never animates */
.at-fab-plus { display: block; }

/* Label */
.at-fab-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Ring spin (comet travels clockwise) */
@keyframes at-orb-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Desktop: hide */
@media (min-width: 769px) {
  .at-mobile-fab-wrap { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════════
   REPLACEMENTS PAGE — Compact header FAB (inline, not fixed)
   Matches admin tasks FAB style but smaller + slower pulse
   ════════════════════════════════════════════════════════════════════ */
.rep-hdr-fab {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #12121e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s, background .15s;
  /* Dim base track ring */
  box-shadow:
    0 0 0 2px rgba(149,213,178,0.14),
    0 4px 18px rgba(0,0,0,.55);
}
.rep-hdr-fab:active {
  background: #1a1a30;
  transform: scale(0.9);
}

/* Spinning comet ring — pseudo on the button itself */
.rep-hdr-fab::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(149,213,178,0.05)  0deg,
    rgba(149,213,178,0.05)  180deg,
    rgba(149,213,178,0.22)  230deg,
    rgba(167,139,250,0.55)  268deg,
    rgba(149,213,178,0.88)  305deg,
    rgba(220,255,240,0.98)  330deg,
    rgba(149,213,178,0.50)  348deg,
    rgba(149,213,178,0.05)  360deg
  );
  /* Slower spin — 4.5s vs admin tasks 2.6s */
  animation: at-orb-spin 4.5s linear infinite;
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent  calc(100% - 4px),
    white        calc(100% - 4px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent  calc(100% - 4px),
    white        calc(100% - 4px)
  );
  pointer-events: none;
  z-index: 0;
}

/* SVG sits above the ring */
.rep-hdr-fab svg {
  position: relative;
  z-index: 1;
}

/* Hide the old new-rep elements that were removed from HTML */
#rep-new-badge-btn,
#new-rep-btn { display: none !important; }


  /* Frosted circles on mobile — slightly larger, and show back button */
  body.mobile-thread-open .chat-hdr-circle {
    width: 40px !important; height: 40px !important;
  }
  body.mobile-thread-open .chat-back-btn {
    display: flex !important;
  }
  body.mobile-thread-open .chat-hdr-avatar {
    width: 42px !important; height: 42px !important;
    font-size: 1rem !important;
  }

  /* Messages: scrollable area between fixed header and composer */
  body.mobile-thread-open .chats-messages {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding: 80px 14px 10px !important;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  body.mobile-thread-open .chats-messages > * {
    flex-shrink: 0;
  }

  /* Composer: stays at bottom of the fixed panel (not sticky — parent is overflow:hidden) */
  body.mobile-thread-open .chats-composer {
    flex-shrink: 0 !important;
    border-top: 1px solid var(--border);
    background: var(--bg2);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
    z-index: 15;
  }
  .chats-messages > * { flex-shrink: 0; }

  /* Composer — pinned at bottom */
  .chats-composer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg2);
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  /* Prevent iOS zoom on focus — must be >= 16px */
  .chats-textarea,
  .chat-search-input,
  #chats-input {
    font-size: 16px !important;
  }

  /* Hide markdown formatting bar on mobile — it shows raw syntax */
  .chats-fmt-bar {
    display: none;
  }

  /* Overlapping events get subtle shadow for depth */
  .cmw-event { box-shadow: 1px 0 3px rgba(0,0,0,0.2); }
}

/* ── Mobile calendar: solid event tiles + multi-line titles ── */
@media (max-width: 768px) {
  .cmw-event {
    border-radius: 3px;
    padding: 2px 3px;
    overflow: hidden;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  }
  .cmw-event-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: #fff;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    line-height: 1.2;
  }
  .cmw-event-sub {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.1;
    margin-top: 1px;
  }
  .cmw-event-time {
    font-size: 0.45rem;
    color: rgba(255,255,255,0.6);
  }
}

/* ── Mobile calendar: recurring event arrow pattern ── */
@media (max-width: 768px) {
  .cmw-recurring {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M3 8h7M7.5 5L10.5 8 7.5 11' stroke='rgba(0,0,0,0.15)' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-size: 16px 16px !important;
    background-repeat: repeat !important;
    background-blend-mode: normal;
  }
  /* 3-button event type toggle */
  .cal-drawer-etype {
    display: flex;
    gap: 0;
  }
  .cal-drawer-etype .cal-dv-btn {
    font-size: 0.78rem;
    padding: 8px 6px;
  }
}

/* ═══ CHAT — back button + header icons (desktop defaults) ═══ */
.chat-back-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
/* Desktop: hide back button (sidebar handles navigation) */
@media (min-width: 769px) {
  .chat-back-btn { display: none !important; }
}

/* ═══ MOBILE CHAT — iMessage list + Slack thread ═══ */
@media (max-width: 768px) {
  /* Hide the page header on mobile for chats — space is premium */
  #view-chats > .page-header { display: none; }
  /* When a thread is open: strip all main-content padding so the panel is edge-to-edge */
  body.mobile-thread-open .main-content {
    padding: 0 !important;
  }

  /* Chats tab — conversations ARE the page, no inner scroll box */
  #view-chats.active {
    padding: 0 !important;
    /* .main-content already offsets for the fixed nav — no extra padding needed */
  }
}

/* ══════════════════════════════════════════════════════════════
   TECH TASKS — MOBILE OVERHAUL
   Full-width scroll-snap columns, orange accents, custom FAB
   ══════════════════════════════════════════════════════════════ */

/* ── Header: hide desktop-only controls on mobile ── */
@media (max-width: 768px) {
  .ttech-page-header {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 14px;
  }
  .ttech-desktop-controls { display: none !important; }
  .ttech-mobile-archives-btn { display: flex !important; }

/* ── Prevent the page itself from scrolling horizontally ──
   This is the root fix: cols-scroll is its own isolated context,
   the page header never sweeps away with the column swipe.        ── */
  #view-tasks {
    overflow-x: hidden;
  }

  /* ── Reset #tasks-kanban desktop flex layout ── */
  #tasks-kanban {
    display: block;
    overflow: hidden;
    padding: 0;
    height: auto;
  }

  #tasks-kanban .mobile-tasks-tabs-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
  }

  /* ── Tab bar: JS-scrolled proportionally, user cannot drag it ── */
  #ttech-tab-bar.mobile-tasks-tab-bar {
    overflow-x: auto !important;    /* JS drives scrollLeft, user touch prevented */
    scrollbar-width: none;
    flex-shrink: 0;
  }
  #ttech-tab-bar::-webkit-scrollbar { display: none; }

  .ttech-tab-btn {
    flex: 0 0 auto;                 /* natural width so partial tabs peek at edges */
    white-space: nowrap;
    padding: 10px 18px;
    font-size: .8rem;
  }
  .ttech-tab-btn.active {
    color: #fb923c !important;
    border-bottom-color: #fb923c !important;
  }
  .ttech-tab-btn:not(.active) { color: var(--text2); }

  /* ── Column track — JS-controlled scroll, no native momentum ── */
  .ttech-mobile-cols-scroll {
    display: flex;
    overflow-x: hidden;            /* JS sets scrollLeft; no native momentum swipe */
    overflow-y: hidden;
    scrollbar-width: none;
    height: calc(100dvh - var(--top-nav-h, 56px) - 90px - 46px);
  }
  .ttech-mobile-cols-scroll::-webkit-scrollbar { display: none; }

  /* ── Individual column panel ── */
  .ttech-mobile-col-panel {
    flex-shrink: 0;
    width: 100vw;
    min-width: 100vw;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 14px 20px calc(120px + env(safe-area-inset-bottom, 20px));
    box-sizing: border-box;
  }

  /* Task cards stay within panel */
  .ttech-mobile-col-panel .tkan-card {
    max-width: 100%;
    box-sizing: border-box;
  }


  /* ── Tech Tasks FAB — raised well above browser chrome ── */
  .ttech-mobile-fab-wrap {
    position: fixed;
    /* Extra high bottom so it clears iOS Safari toolbar + safe area */
    bottom: calc(env(safe-area-inset-bottom, 20px) + 72px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    z-index: 1200;
    pointer-events: none;
    transition: opacity .2s;
  }
  .ttech-mobile-fab-wrap > * { pointer-events: auto; }

  .ttech-fab-ring-wrap {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
      0 0 0 3px rgba(251,146,60,.25),
      0 0 14px rgba(251,146,60,.18),
      0 6px 28px rgba(0,0,0,.60);
  }

  /* Static decorative ring (no spin) */
  .ttech-fab-ring-wrap::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(
      from 0deg,
      rgba(251,146,60,.08)  0deg,
      rgba(45,212,191,.55) 90deg,
      rgba(251,146,60,.85) 200deg,
      rgba(255,200,80,.98)  270deg,
      rgba(45,212,191,.45) 330deg,
      rgba(251,146,60,.08) 360deg
    );
    -webkit-mask: radial-gradient(
      farthest-side,
      transparent  calc(100% - 4px),
      white        calc(100% - 4px)
    );
    mask: radial-gradient(
      farthest-side,
      transparent  calc(100% - 4px),
      white        calc(100% - 4px)
    );
    pointer-events: none;
    z-index: 0;
  }

  .ttech-fab-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1a1a2e, #12121e);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: background .15s, transform .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .ttech-fab-btn:active {
    background: linear-gradient(145deg, #1e1e35, #1a1a2e);
    transform: scale(0.91);
  }

  .ttech-fab-label {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    color: rgba(251,146,60,.7);
    text-transform: uppercase;
    white-space: nowrap;
  }
}

/* Desktop: hide mobile-only elements */
@media (min-width: 769px) {
  .ttech-mobile-archives-btn { display: none !important; }
  .ttech-mobile-fab-wrap     { display: none !important; }
}




/* ── Remove Tech Confirmation Modal ── */
.rtc-consequence {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg3, rgba(255,255,255,.04));
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,.08));
  font-size: .85rem;
  color: var(--text, #e2e8f0);
  line-height: 1.45;
}
.rtc-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.rtc-icon--warn { filter: drop-shadow(0 0 4px rgba(251,191,36,.4)); }
.rtc-icon--info { filter: drop-shadow(0 0 4px rgba(96,165,250,.35)); }

