/* Team Inbox PWA — portal-matched design (Shadcn-like elevation) */
:root {
  --brand: #2563eb;
  --brand-2: #3b82f6;
  --brand-soft: #eff6ff;
  --brand-ink: #1d4ed8;
  --ink: #20252b;
  --muted: #6b7280;
  --line: #e5e7eb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 8px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 3px 10px rgba(32, 37, 43, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16), 0 8px 16px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 6px 16px rgba(37, 99, 235, 0.18);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--brand); }

#app {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-2);
}

/* —— Login (portal hero style) —— */
.login {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding: calc(1.5rem + var(--safe-top)) 1.25rem calc(1.5rem + var(--safe-bottom));
  background: linear-gradient(180deg, #eff6ff 0%, #f9fafb 42%, #fff 100%);
}
.login-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 10px;
  padding: 1.75rem 1.35rem;
  box-shadow: var(--shadow-lg);
  animation: riseIn 0.65s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.brand-mark {
  width: 56px; height: 56px; border-radius: 10px;
  background: var(--brand);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-glow);
  transition: transform 0.45s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.login-card:hover .brand-mark { transform: scale(1.06) rotate(-3deg); }
.login h1 {
  margin: 0 0 0.35rem; font-size: 1.55rem; font-weight: 800; letter-spacing: -0.03em;
}
.login .sub { margin: 0 0 1.35rem; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.field { margin-bottom: 0.9rem; }
.field label {
  display: block; font-size: 0.72rem; font-weight: 700; color: var(--muted);
  margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.field input {
  width: 100%; padding: 0.85rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font-size: 1rem;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  outline: none; border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; padding: 0.9rem 1rem;
  border-radius: var(--radius-sm); font-weight: 700; font-size: 0.95rem;
  overflow: hidden; isolation: isolate;
  transition: transform 0.4s cubic-bezier(0.22, 1.2, 0.36, 1), box-shadow 0.25s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.4);
}
.btn-primary:hover::before { transform: translateX(120%); }
.btn-primary:disabled { opacity: 0.55; }
.btn-ghost {
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.btn-ghost:active { background: var(--surface-2); }
@media (prefers-reduced-motion: reduce) {
  .login-card { animation: none; }
  .btn-primary::before { display: none; }
  .btn, .brand-mark { transition: none; }
}
.err {
  color: var(--danger); font-size: 0.85rem; margin: 0.5rem 0 0; min-height: 1.2em;
}
.login-foot {
  margin-top: 1.25rem; text-align: center; font-size: 0.8rem; color: var(--muted); line-height: 1.5;
}
.login-foot a { font-weight: 650; text-decoration: none; }

/* —— Shell —— */
.shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; gap: 0.65rem;
  padding: calc(0.7rem + var(--safe-top)) 1rem 0.7rem;
  background: #ffffff;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
.topbar h1 {
  flex: 1; margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  color: var(--ink); font-size: 1.05rem;
}
.icon-btn:active { background: var(--brand-soft); border-color: #bfdbfe; }

.tabs {
  display: flex; gap: 0.35rem;
  padding: 0.45rem 0.75rem calc(0.55rem + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.06);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
.tab {
  flex: 1; padding: 0.55rem 0.25rem;
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  color: var(--muted); font-size: 0.65rem; font-weight: 700;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.tab .glyph {
  width: 28px; height: 28px; border-radius: 10px;
  display: grid; place-items: center;
  background: transparent;
  color: inherit;
}
.tab .glyph .ico { width: 20px; height: 20px; display: block; }
.tab.active {
  color: var(--brand-ink);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.tab.active .glyph {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel.active { display: flex; }

/* —— Inbox —— */
.search-bar { padding: 0.75rem 1rem 0.35rem; }
.search-bar input {
  width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 0.9rem center no-repeat;
  font-size: 0.92rem;
  box-shadow: var(--shadow-sm);
}
.search-bar input:focus {
  outline: none; border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15), var(--shadow-sm);
}
.filters {
  display: flex; gap: 0.4rem; padding: 0.5rem 1rem 0.65rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.chip {
  flex-shrink: 0; padding: 0.4rem 0.85rem;
  border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: #fff; color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.chip.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.convo-list { list-style: none; margin: 0; padding: 0 0.65rem 1rem; }
/* Nested list inside .scroll-panel must not create a second scrollport (breaks iOS touch). */
.scroll-panel .convo-list {
  flex: none;
  overflow: visible;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0.35rem;
}
/* Direct panel list (if used) scrolls as the sole vertical scroller. */
.panel > .convo-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}
.convo {
  display: flex; gap: 0.75rem; align-items: center;
  padding: 0.85rem 0.9rem; margin-bottom: 0.45rem;
  background: #fff; border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.12s, border-color 0.15s;
}
.convo:active {
  transform: scale(0.985);
  box-shadow: var(--shadow-md);
  border-color: #bfdbfe;
}
.avatar {
  width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.95rem; color: #fff;
  background: var(--brand);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.convo-body { flex: 1; min-width: 0; }
.convo-top {
  display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline;
}
.convo-name {
  font-weight: 750; font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.convo-time { font-size: 0.68rem; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.convo-preview {
  margin-top: 0.2rem; font-size: 0.8rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.convo-meta { display: flex; gap: 0.35rem; margin-top: 0.4rem; flex-wrap: wrap; }
.badge {
  font-size: 0.62rem; font-weight: 750; padding: 0.18rem 0.45rem;
  border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink);
}
.badge.warn { background: #fff7ed; color: #c2410c; }
.badge.ok { background: #ecfdf5; color: #047857; }
.badge.muted { background: #f1f5f9; color: #475569; }
.unread {
  min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 0.68rem; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}
.empty {
  text-align: center; padding: 3rem 1.5rem; color: var(--muted); font-size: 0.9rem;
}
.empty-card {
  background: #fff; border: 1px dashed var(--line); border-radius: 10px;
  padding: 2rem 1.25rem; box-shadow: var(--shadow-xs);
}

/* —— Chat —— */
.chat-panel { background: #f1f4f4; }
.chat-panel > .filters { flex-shrink: 0; }
.crm-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
}
.crm-strip strong {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-ink);
  margin-bottom: 0.1rem;
}
.crm-strip > div { min-width: 0; flex: 1; }
.crm-strip span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-panel .composer {
  padding-bottom: 0.65rem;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scroll-behavior: auto;
  overflow-anchor: none;
  padding: 1rem;
  display: flex; flex-direction: column; gap: 0.55rem;
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(37, 99, 235, 0.08), transparent),
    linear-gradient(180deg, #f1f4f4, #f7f8fa);
}
.bubble {
  max-width: 82%; padding: 0.7rem 0.9rem;
  border-radius: 10px; font-size: 0.92rem; line-height: 1.4;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
  animation: bubbleIn 0.22s ease-out;
  position: relative;
}
.media-block { display: flex; flex-direction: column; gap: 0.35rem; }
.media-link {
  display: block; cursor: zoom-in; border-radius: 12px; overflow: hidden;
  max-width: 240px; position: relative;
}
.media-img {
  display: block; width: 100%; max-width: 240px; max-height: 280px;
  object-fit: cover; border-radius: 12px; background: rgba(15, 23, 42, 0.06);
}
.media-video { width: 100%; max-width: 240px; max-height: 240px; border-radius: 12px; background: #0f172a; }
.media-video-link { cursor: pointer; }
.media-preview { pointer-events: none; }
.media-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 42px; height: 42px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(15, 23, 42, 0.55); color: #fff; font-size: 0.95rem;
}
.media-open {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer;
}
.media-caption { font-size: 0.88rem; line-height: 1.35; }

.lightbox {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 1rem;
}
.lightbox-backdrop {
  position: absolute; inset: 0; border: 0; margin: 0; padding: 0;
  background: rgba(15, 23, 42, 0.78); cursor: zoom-out;
}
.lightbox-inner {
  position: relative; z-index: 1; width: min(920px, 96vw); max-height: 90vh;
  display: flex; flex-direction: column; align-items: stretch; gap: 0.65rem;
}
.lightbox-title {
  margin: 0; text-align: center; color: #fff; font-size: 0.85rem; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lightbox-body {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; min-height: 120px; max-height: calc(90vh - 5rem); overflow: auto;
}
.lightbox-img {
  display: block; max-width: 100%; max-height: calc(90vh - 5.5rem);
  object-fit: contain; border-radius: 10px; background: #0f172a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.lightbox-video {
  display: block; width: 100%; max-height: calc(90vh - 5.5rem);
  border-radius: 10px; background: #0f172a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.lightbox-audio { width: 100%; max-width: 420px; }
.lightbox-frame {
  display: block; width: 100%; height: min(72vh, 640px);
  border: 0; border-radius: 10px; background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.lightbox-hint {
  margin: 0; color: rgba(255,255,255,.85); font-size: 0.78rem; text-align: center; line-height: 1.4;
}
.lightbox-actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
}
.lightbox-close, .lightbox-download {
  width: auto !important; color: #fff !important; border-color: rgba(255,255,255,.3) !important;
  background: rgba(255,255,255,.12) !important; text-decoration: none;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.bubble.in {
  align-self: flex-start;
  background: #fff; color: var(--ink);
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(226, 232, 240, 0.9);
}
.bubble.out {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
}
.bubble.deleted {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px dashed #cbd5e1 !important;
  box-shadow: none !important;
}
.bubble.deleted .deleted-msg {
  font-style: italic;
  font-size: 0.88rem;
}
.msg-actions {
  position: absolute;
  top: 0.2rem;
  right: 0.3rem;
  z-index: 2;
}
.bubble.in .msg-actions { right: auto; left: 0.3rem; }
.msg-menu-btn {
  width: 24px; height: 24px; padding: 0; margin: 0;
  border: none; border-radius: 8px;
  background: rgba(15, 23, 42, 0.08);
  color: inherit; font-size: 0.9rem; line-height: 1;
  cursor: pointer; opacity: 0.55;
}
.bubble.out .msg-menu-btn { background: rgba(255,255,255,.22); color: #fff; }
.msg-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.2rem;
  min-width: 168px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.bubble.in .msg-menu { right: auto; left: 0; }
.msg-menu[hidden] { display: none !important; }
.msg-action {
  width: 100%; margin: 0; padding: 0.5rem 0.7rem;
  background: transparent; border: none; border-radius: 8px;
  font-size: 0.78rem; font-weight: 650; text-align: left; cursor: pointer;
  color: var(--ink);
}
.msg-action:hover, .msg-action:active { background: #f1f5f9; }
.bubble .meta {
  margin-top: 0.3rem; font-size: 0.62rem; opacity: 0.7; text-align: right; font-weight: 600;
}
.composer {
  display: flex; flex-direction: column; gap: 0.45rem; align-items: stretch;
  padding: 0.65rem 0.85rem calc(0.65rem + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.05);
  flex-shrink: 0;
}
.composer-row {
  display: flex; gap: 0.5rem; align-items: flex-end;
}
.reply-from {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.5rem;
}
.reply-from-label {
  font-size: 0.68rem; font-weight: 750; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.reply-from-options { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.reply-chip {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 999px; padding: 0.28rem 0.7rem; font-size: 0.72rem; font-weight: 700;
  cursor: pointer;
}
.reply-chip.active {
  background: #111827; color: #fff; border-color: #111827;
}
.composer textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 120px;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); font-size: 0.95rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}
.composer textarea:focus {
  outline: none; border-color: #93c5fd; background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.composer .send {
  width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 1.15rem;
  box-shadow: var(--shadow-glow);
  display: grid; place-items: center;
}

/* —— CRM / Settings —— */
.scroll-panel {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding: 1rem;
  padding-bottom: 1.5rem;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.95rem 0.95rem;
  margin-bottom: 0.7rem;
  box-shadow: var(--shadow-xs);
}
.card h2 {
  margin: 0 0 0.35rem; font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.card p { margin: 0.35rem 0; font-size: 0.9rem; line-height: 1.45; }
.card .value { font-weight: 750; font-size: 1.05rem; letter-spacing: -0.01em; }

.home-panel { padding-top: 0.5rem; }
.home-hero {
  padding: 0.35rem 0.15rem 0.85rem;
}
.home-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.home-hello {
  margin: 0.2rem 0 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.home-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}
.home-model {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.home-model strong {
  display: block;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.home-model ul { margin: 0 0 0.4rem; padding-left: 1rem; }
.home-model li { margin: 0.12rem 0; }
.home-model b { color: var(--ink); font-weight: 750; }
.home-model p { margin: 0; }
.home-sales-card {
  background: linear-gradient(145deg, #20252b 0%, #334047 100%);
  color: #fff;
  border-radius: 10px;
  padding: 1.1rem 1.15rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-md);
}
.home-sales-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}
.home-sales-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.25rem;
}
.home-sales-top strong {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.home-sales-top em {
  display: block;
  font-style: normal;
  font-size: 0.75rem;
  opacity: 0.65;
  margin-top: 0.15rem;
}
.home-sales-won {
  text-align: right;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
}
.home-sales-won span {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.7;
}
.home-sales-won strong { font-size: 1rem; }
.home-stage-bars { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; }
.home-stage-bar {
  display: grid;
  grid-template-columns: 72px 1fr 28px;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 650;
}
.home-stage-bar span { text-transform: capitalize; opacity: 0.85; }
.home-stage-bar i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  position: relative;
  overflow: hidden;
}
.home-stage-bar i::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: #2563eb;
  border-radius: 999px;
}
.home-stage-bar b { text-align: right; font-weight: 800; }
.home-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.home-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.25rem 0.65rem;
  text-align: center;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.home-stat-ico {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
}
.home-stat-ico .ico { width: 15px; height: 15px; display: block; }
.home-stat strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand-ink);
}
.home-stat span {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.home-kpis { grid-template-columns: repeat(4, 1fr) !important; }
.home-section {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.home-tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 0.7rem;
  padding: 0.85rem 0.8rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.home-tile:active { transform: scale(0.98); }
.home-tile-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.home-tile-icon .ico { width: 24px; height: 24px; display: block; }
.home-tile-body { min-width: 0; flex: 1; }
.home-tile strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink);
}
.home-tile strong em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.25rem;
}
.home-tile-body > span { font-size: 0.72rem; color: var(--muted); line-height: 1.35; }
.home-recent { padding-left: 0; padding-right: 0; }
.t-blue, .t-violet, .t-pink, .t-orange, .t-teal, .t-green, .t-cyan { background: var(--brand); }
.t-slate, .t-indigo { background: #475569; }

.crm-subnav {
  display: flex; gap: 0.4rem; margin-bottom: 0.85rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.crm-object-switcher {
  position: relative;
  z-index: 6;
  margin-bottom: 0.75rem;
}
.crm-object-switcher-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 750;
}
.crm-object-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5;
  border: 0;
  background: rgba(32, 37, 43, 0.28);
}
.crm-object-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.crm-object-menu-item {
  min-height: 40px;
  padding: 0 0.7rem;
  text-align: left;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 700;
}
.crm-object-menu-item.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.crm-hero .crm-kpis {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
  margin-top: 0.9rem;
}
.crm-kpis > div {
  background: linear-gradient(160deg, #fff, var(--brand-soft));
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.7rem 0.55rem; text-align: center;
}
.crm-kpis strong {
  display: block; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.03em;
  color: var(--brand-ink);
}
.crm-kpis span { font-size: 0.65rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pipe-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem;
}
@media (min-width: 420px) {
  .pipe-grid { grid-template-columns: repeat(3, 1fr); }
}
.pipe-card {
  text-align: left; padding: 0.75rem 0.8rem;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-xs);
}
.pipe-card.active {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14), var(--shadow-sm);
  background: var(--brand-soft);
}
.pipe-stage {
  display: block; font-size: 0.65rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.pipe-card strong { display: block; font-size: 1.35rem; margin: 0.2rem 0; letter-spacing: -0.03em; }
.pipe-amt { font-size: 0.72rem; color: var(--muted); font-weight: 650; }

.kanban {
  display: flex; gap: 0.65rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0 0.85rem;
  scroll-snap-type: x mandatory;
}
.kanban-col {
  flex: 0 0 min(78vw, 260px);
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  min-height: 280px;
  display: flex; flex-direction: column;
}
.kanban-col header {
  display: flex; align-items: baseline; gap: 0.4rem;
  padding: 0.7rem 0.8rem 0.45rem;
  border-bottom: 1px solid var(--line);
}
.kanban-col header span {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
}
.kanban-col header strong { font-size: 0.95rem; color: var(--brand-ink); }
.kanban-col header em { margin-left: auto; font-style: normal; font-size: 0.68rem; color: var(--muted); font-weight: 650; }
.kanban-cards {
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
  min-height: 0;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}
.kanban-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-xs); padding: 0.55rem;
}
.kanban-card-main {
  display: block; width: 100%; text-align: left; padding: 0.25rem 0.2rem 0.45rem;
}
.kanban-card-main strong { display: block; font-size: 0.88rem; font-weight: 750; }
.kanban-card-main span { display: block; margin-top: 0.2rem; font-size: 0.72rem; color: var(--muted); }
.kanban-card-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.kanban-empty {
  text-align: center; color: var(--muted); font-size: 0.75rem;
  padding: 1.5rem 0.5rem; border: 1px dashed var(--line); border-radius: 12px;
}
.crm-quick-row {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 0.4rem;
  margin-top: 0.85rem;
}
.crm-quick-row .btn { padding: 0.65rem 0.4rem; font-size: 0.78rem; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-row {
  display: flex; gap: 0.65rem; align-items: center; justify-content: space-between;
  padding: 0.85rem 0.9rem; margin-bottom: 0.45rem;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-xs);
}
.task-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.crm-detail-head { display: flex; gap: 0.85rem; align-items: center; }
.inline-form { display: flex; gap: 0.45rem; align-items: center; }
.inline-form input {
  flex: 1; padding: 0.65rem 0.85rem; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; font-size: 0.9rem;
}
.note-card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 0.7rem 0.85rem; margin: 0.45rem 0;
  font-size: 0.88rem; line-height: 1.4;
}
.note-meta { margin-top: 0.35rem; font-size: 0.68rem; color: var(--muted); font-weight: 650; }
.tl-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin: 0.45rem 0;
  font-size: 0.88rem;
  line-height: 1.4;
}
.tl-head {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.tl-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.tl-icon .ico { width: 16px; height: 16px; display: block; }
.tl-body { min-width: 0; flex: 1; }
.crm-actions { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.75rem; }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.stat {
  background: linear-gradient(160deg, #fff, var(--brand-soft));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 0.9rem;
  box-shadow: var(--shadow-sm);
}
.stat .n {
  font-size: 1.55rem; font-weight: 800; letter-spacing: -0.03em;
  background: var(--brand);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .l { font-size: 0.72rem; color: var(--muted); font-weight: 650; margin-top: 0.15rem; }
.install-steps { margin: 0.65rem 0 0; padding-left: 1.15rem; font-size: 0.88rem; color: var(--ink); line-height: 1.65; }
.install-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(43, 150, 138, 0.08));
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
}
.install-banner strong { display: block; margin-bottom: 0.25rem; font-size: 0.95rem; }
.ios-hint { font-size: 0.82rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.45; }

.toast {
  position: fixed; left: 50%; bottom: calc(5.5rem + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 0.65rem 1.1rem; border-radius: 999px;
  font-size: 0.82rem; font-weight: 650;
  z-index: 60; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: var(--shadow-lg); max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.hidden { display: none !important; }
.adapt-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  background: var(--brand);
  color: #fff; text-align: center;
  font-size: 0.78rem; font-weight: 650;
  padding: 0.55rem 0.85rem;
  box-shadow: var(--shadow-sm);
}
.adapt-banner a, .adapt-banner button {
  color: #fff; font-weight: 800; margin-left: 0.35rem;
  background: transparent; border: none; text-decoration: underline;
  cursor: pointer; font: inherit;
}
.offline-banner {
  background: linear-gradient(90deg, #1e293b, #334155);
  color: #fff; text-align: center; font-size: 0.75rem; font-weight: 650;
  padding: 0.55rem 0.85rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

@media (min-width: 720px) {
  body {
    background:
      radial-gradient(ellipse 60% 40% at 50% -10%, rgba(37, 99, 235, 0.35), transparent),
      #0f172a;
  }
  #app {
    max-width: 430px; margin: 0 auto;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
  .login { max-width: 430px; margin: 0 auto; }
}

/* Compact CRM controls and record sheets. */
.crm-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: .65rem; }
.crm-heading-row > div { min-width: 0; flex: 1; }
.crm-heading-btn { width: auto; min-height: 44px; padding: .6rem .75rem; font-size: .75rem; white-space: nowrap; box-shadow: none; }
.crm-detail-actions { display: grid; grid-template-columns: 1fr 1fr; }
.company-avatar { display: grid; place-items: center; }
.company-avatar .ico { width: 22px; height: 22px; }
.crm-task-filters { padding: .55rem 0 0; }
.request-error { display: flex; flex-direction: column; gap: .45rem; align-items: flex-start; padding: 1rem; border: 1px solid #fecaca; border-radius: 10px; background: #fef2f2; color: var(--danger); }
.request-error span { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.crm-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: rgba(32, 37, 43, .36); }
.crm-modal-card { width: min(100%, 430px); max-height: min(92dvh, 760px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; padding: 1rem; box-shadow: var(--shadow-lg); }
.crm-modal-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: .9rem; }
.crm-modal-head h2 { margin: 0; font-size: 1rem; color: var(--ink); }
.crm-modal-fields { display: grid; gap: .75rem; }
.crm-modal-fields label { display: grid; gap: .35rem; color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.crm-modal-fields input, .crm-modal-fields select { width: 100%; min-height: 44px; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface-2); font-size: .92rem; text-transform: none; letter-spacing: normal; }
.crm-modal-fields input:focus, .crm-modal-fields select:focus { outline: 2px solid rgba(37, 99, 235, .24); border-color: var(--brand); }
.crm-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: 1rem; }
.crm-modal-actions .btn { min-height: 44px; }
.home-section-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.home-section-row .home-section { margin-bottom: .65rem; }
.link-btn { color: var(--brand); font-size: .75rem; font-weight: 750; }
.home-task-list { display: flex; flex-direction: column; gap: .4rem; }
.home-task-row { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .65rem .7rem; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.home-task-mark { width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0; border-radius: 8px; color: var(--brand); background: var(--brand-soft); }
.home-task-mark .ico { width: 16px; height: 16px; }
.home-task-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.home-task-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.home-task-body small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; }
.home-task-row time { color: var(--muted); flex-shrink: 0; font-size: .68rem; font-weight: 700; }
.home-task-empty { padding: .8rem 1rem; }
.task-detail-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

/* —— Twenty-style record surfaces —— */
.sort-select { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.2rem 0 0.5rem; color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.sort-select select { border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 0.8rem; font-weight: 600; padding: 0.3rem 0.5rem; text-transform: none; letter-spacing: normal; }
.sort-select select:focus { outline: 2px solid rgba(37, 99, 235, 0.24); border-color: var(--brand); }

.fav-bar { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.15rem 0 0.55rem; scrollbar-width: none; }
.fav-bar::-webkit-scrollbar { display: none; }
.fav-chip { display: inline-flex; align-items: center; gap: 0.35rem; flex-shrink: 0; padding: 0.35rem 0.6rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 0.76rem; font-weight: 650; color: var(--ink); box-shadow: var(--shadow-xs); }
.fav-chip:active { background: var(--brand-soft); }
.fav-ico { display: inline-flex; color: var(--brand); }
.fav-ico .ico { width: 13px; height: 13px; }
.fav-btn { padding: 0 0.25rem; font-size: 1.05rem; line-height: 1; color: #d1d5db; vertical-align: -0.08em; }
.fav-btn.on { color: #f59e0b; }

.rec-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.rec-row { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.7rem; box-shadow: var(--shadow-xs); }
.rec-row:active { background: var(--brand-soft); }
.rec-main { min-width: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.rec-main strong { font-size: 0.85rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-sub { color: var(--muted); font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-side { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.rec-amt { font-size: 0.83rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.badge.stage-new { background: var(--surface-2); color: var(--muted); }
.badge.stage-qualified { background: #ecfdf5; color: #047857; }
.badge.stage-proposal { background: #fffbeb; color: #b45309; }
.badge.stage-negotiation { background: var(--brand-soft); color: var(--brand-ink); }
.badge.stage-won { background: #d1fae5; color: #065f46; }
.badge.stage-lost { background: #fee2e2; color: #b91c1c; }
.badge.stage-contacted { background: #f0f9ff; color: #0369a1; }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem 1rem; }
.kv { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.kv-k { color: var(--muted); font-size: 0.68rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; }
.kv-v { font-size: 0.85rem; font-weight: 550; overflow-wrap: anywhere; }
.kv-link { color: var(--brand); font-weight: 650; font-size: inherit; padding: 0; text-align: left; }

.stageflow { display: flex; flex-direction: column; gap: 0.45rem; }
.stageflow-row { display: grid; grid-template-columns: minmax(74px, 28%) 1fr auto; align-items: center; gap: 0.5rem; }
.stageflow-name { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: capitalize; }
.stageflow-row.open .stageflow-name { color: var(--brand-ink); font-weight: 750; }
.stageflow-name em { font-style: normal; font-size: 0.62rem; color: var(--brand); font-weight: 800; }
.stageflow-row i { display: block; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.stageflow-row i b { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.stageflow-row.open i b { background: var(--brand-2); }
.stageflow-days { font-size: 0.72rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

.act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.act-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.7rem; box-shadow: var(--shadow-xs); }
.act-item:active { background: var(--brand-soft); }
.act-item[disabled] { opacity: 0.75; }
.act-ico { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; color: var(--brand); background: var(--brand-soft); }
.act-ico .ico { width: 15px; height: 15px; }
.act-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.act-body strong { font-size: 0.82rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-body small { color: var(--muted); font-size: 0.72rem; }

.obj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.obj-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; padding: 0.75rem 0.8rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-align: left; box-shadow: var(--shadow-xs); }
.obj-card:active { background: var(--brand-soft); }
.obj-card strong { font-size: 0.86rem; font-weight: 650; }
.obj-card span { color: var(--muted); font-size: 0.72rem; }

.rel-head { margin: 0.5rem 0 0.3rem; color: var(--muted); font-size: 0.7rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; }
.rel-head:first-of-type { margin-top: 0.15rem; }
.rel-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rel-chip { padding: 0.32rem 0.6rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; font-size: 0.76rem; font-weight: 600; color: var(--ink); }
.rel-chip:active { background: var(--brand-soft); border-color: #bfdbfe; }

.note-del { color: var(--danger); font-size: 0.7rem; font-weight: 700; padding: 0 0.15rem; }
.crm-chip-row { padding: 0 0 0.45rem; }

/* —— Pass-2: quick-create composers, task checkboxes, note composer —— */
.quick-add { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin: 0.1rem 0 0.65rem; }
.quick-add input, .quick-add select {
  min-height: 38px; min-width: 0; flex: 1 1 7rem; padding: 0.45rem 0.6rem;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  color: var(--ink); font-size: 0.83rem;
}
.quick-add input[name="title"], .quick-add input[name="name"] { flex-basis: 100%; }
.quick-add input[type="date"] { flex: 0 1 8rem; color: var(--muted); }
.quick-add select { flex: 1 1 8rem; }
.quick-add .qa-btn { width: auto; flex-shrink: 0; min-height: 38px; padding: 0.45rem 0.85rem; font-size: 0.8rem; }
.quick-add .btn-ghost { width: auto; }
.quick-add input:focus, .quick-add select:focus { outline: 2px solid rgba(37, 99, 235, 0.22); border-color: var(--brand); }
.qa-cancel { min-height: 34px; font-size: 0.78rem; }

.task-check {
  width: 20px; height: 20px; flex-shrink: 0; margin-top: 0.15rem;
  border: 1.5px solid #cbd5e1; border-radius: 6px; background: #fff;
  display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 800; color: #fff; line-height: 1;
}
.task-check:hover { border-color: var(--brand); }
.task-check.done { background: var(--brand); border-color: var(--brand); }
.task-body { min-width: 0; flex: 1; }
.task-row { display: flex; align-items: flex-start; gap: 0.55rem; }
.task-row.done strong { text-decoration: line-through; color: var(--muted); font-weight: 550; }
.due-chip {
  display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 0.68rem; font-weight: 700; vertical-align: 0.06em;
}
.due-chip.due-late { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.due-chip.due-today { background: #fffbeb; border-color: #fde68a; color: #b45309; }

.note-composer { display: flex; gap: 0.55rem; margin-top: 0.6rem; align-items: flex-start; }
.note-avatar {
  width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 7px; background: var(--brand-soft); color: var(--brand);
}
.note-avatar .ico { width: 14px; height: 14px; }
.note-editor { flex: 1; min-width: 0; }
.note-editor textarea {
  width: 100%; padding: 0.55rem 0.65rem; border: 1px solid var(--line);
  border-radius: 8px; resize: vertical; min-height: 40px; max-height: 160px;
  font-size: 0.85rem; color: var(--ink); background: #fff;
}
.note-editor textarea:focus { outline: 2px solid rgba(37, 99, 235, 0.22); border-color: var(--brand); }
.note-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; margin-top: 0.4rem; }
.note-hint { margin-right: auto; color: var(--muted); font-size: 0.68rem; font-weight: 650; }
.note-actions .qa-btn, .note-actions .btn-ghost { width: auto; min-height: 34px; font-size: 0.78rem; }

/* ── Pass 3: leads, call logs, marketing hub ───────────────────────── */
.lead-actions { display: flex; align-items: center; gap: 0.35rem; }
.lead-call {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  color: var(--brand); border: 1px solid #bfdbfe; background: var(--brand-soft);
  flex-shrink: 0;
}
.lead-call svg { width: 15px; height: 15px; }
.lead-call:active { background: #dbeafe; }
.lead-chat { flex-shrink: 0; }

.badge.lead-st-new { background: #f0f9ff; color: #0369a1; }
.badge.lead-st-inquiry { background: var(--surface-2); color: var(--muted); }
.badge.lead-st-lead,
.badge.lead-st-qualified { background: #ecfdf5; color: #047857; }
.badge.lead-st-interested { background: #fffbeb; color: #b45309; }
.badge.lead-st-contacted { background: var(--brand-soft); color: var(--brand-ink); }
.badge.lead-st-lost,
.badge.lead-st-junk { background: #fee2e2; color: #b91c1c; }

.call-dir {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; font-size: 15px; flex-shrink: 0;
}
.call-dir.call-in { background: #ecfdf5; color: #047857; }
.call-dir.call-out { background: var(--brand-soft); color: var(--brand-ink); }
.badge.call-st-answered,
.badge.call-st-completed { background: #ecfdf5; color: #047857; }
.badge.call-st-missed,
.badge.call-st-rejected { background: #fee2e2; color: #b91c1c; }
.badge.call-st-initiated { background: var(--surface-2); color: var(--muted); }

.mkt-card .mkt-card-sub { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.83rem; }
.mkt-home-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mkt-home-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; color: var(--ink-2);
  padding: 0.22rem 0.55rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.mkt-dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.mkt-dot-configured { background: #10b981; }
.mkt-dot-partial { background: #f59e0b; }
.mkt-dot-missing,
.mkt-dot-idle { background: #cbd5e1; }

.mkt-platform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.mkt-platform {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff;
}
.mkt-platform-name { font-weight: 600; font-size: 0.85rem; }
.mkt-platform-meta { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.badge.mkt-cred-configured { background: #ecfdf5; color: #047857; }
.badge.mkt-cred-partial { background: #fffbeb; color: #b45309; }
.badge.mkt-cred-missing { background: var(--surface-2); color: var(--muted); }

.badge.mkt-q-valid { background: #ecfdf5; color: #047857; }
.badge.mkt-q-invalid { background: #fee2e2; color: #b91c1c; }
.badge.mkt-q-suspect { background: #fffbeb; color: #b45309; }
.badge.mkt-q-unscreened { background: var(--surface-2); color: var(--muted); }

.mkt-empty {
  padding: 0.9rem; border: 1px dashed var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--muted);
  font-size: 0.83rem; line-height: 1.45;
}

/* ── workspace settings ── */
.ws-settings-row{display:flex;align-items:center;gap:.7rem;width:100%;text-align:left;cursor:pointer;border:1px solid #e5e7eb}
.ws-settings-row:hover{border-color:#d1d5db}
.ws-settings-row-body{flex:1;display:flex;flex-direction:column;gap:.1rem}
.ws-settings-row-sub{font-size:.78rem;color:#6b7280}
.ws-chev{font-size:1.3rem;color:#9ca3af}
.ws-kv-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:.35rem .9rem}
.ws-kv{display:flex;justify-content:space-between;gap:.6rem;font-size:.82rem;padding:.3rem 0;border-bottom:1px dashed #f1f5f9}
.ws-kv span{color:#6b7280}
.ws-kv strong{font-weight:600;font-size:.82rem;text-align:right;word-break:break-word}
.ws-subhead{font-size:.78rem;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:.04em;margin:.85rem 0 .3rem}
.ws-form{display:flex;flex-direction:column;gap:.5rem;background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;padding:.6rem;margin:.4rem 0}
.ws-form label{display:flex;flex-direction:column;gap:.15rem;font-size:.78rem;color:#374151;font-weight:500}
.ws-form input,.ws-form select{font-size:.85rem;padding:.35rem .5rem;border:1px solid #d1d5db;border-radius:6px;background:#fff}
.ws-form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.5rem}
.ws-form-actions{display:flex;gap:.5rem}
.ws-form-actions .btn{width:auto;padding:.4rem .9rem;font-size:.82rem}
.ws-member-picks{display:flex;flex-wrap:wrap;gap:.3rem .8rem;max-height:7.5rem;overflow-y:auto}
.ws-pick{flex-direction:row!important;display:flex;align-items:center;gap:.3rem;font-size:.8rem;font-weight:400!important;color:#374151}
.ws-obj{border:1px solid #e5e7eb;border-radius:8px;padding:.55rem .7rem;margin:.45rem 0;background:#fff}
.ws-obj-actions{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.4rem}
.ws-field-list{margin:.45rem 0 0;padding:0}
.ws-field-row{border-bottom:1px dashed #f1f5f9}
.ws-secret-once{border:1px solid #fbbf24;background:#fffbeb;color:#92400e}
.ws-secret-once code{font-size:.8rem;word-break:break-all;user-select:all}
