:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ok: #10b981;
  --err: #d92d20;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --scroll-track: #eef2f8;
  --scroll-thumb: #c5d0e8;
  --scroll-thumb-hover: #9fb0d8;
  --scroll-thumb-active: #7f96cf;
  --panel-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 20px rgba(16, 24, 40, 0.05);
  --radius-panel: 16px;
  --radius-control: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body.landing-active {
  background: #f3f4f6;
}

body.session-checking #step-phone,
body.session-checking #step-code,
body.session-checking #step-resume,
body.session-checking #step-work {
  visibility: hidden;
  pointer-events: none;
}

body.session-checking .page::after {
  content: '???????? ??????';
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 2rem 1rem;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.hero { margin-bottom: 1.5rem; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid #c8d3ff;
  background: #edf1ff;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
  padding: 1.25rem;
}

.card + .card { margin-top: 1rem; }

.hidden { display: none !important; }

.label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  font-size: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  margin-bottom: 1rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.text-area { min-height: 88px; resize: vertical; }

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}

.captcha-wrap {
  margin: 0 0 1rem;
}

.captcha-image {
  display: block;
  width: 100%;
  max-width: 280px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  margin: 0 0 0.75rem;
}

.otp-shell {
  position: relative;
  margin-bottom: 1rem;
}

.otp-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  border: 0;
}

.otp-track {
  height: 5.25rem;
  border: 2px solid #8aa2ff;
  border-radius: 1.1rem;
  background: #f2f6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0 1.2rem;
}

.otp-cell {
  flex: 1 1 0;
  min-width: 0;
  max-width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  background: #fff;
  border: 1px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  color: #111827;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.otp-shell.is-otp-6 .otp-track {
  gap: 0.4rem;
  padding: 0 0.85rem;
}

.otp-shell.is-otp-6 .otp-cell {
  max-width: 2.55rem;
  height: 2.75rem;
  font-size: 1.45rem;
  border-radius: 0.65rem;
}

.otp-cell.filled {
  border-color: #315efb;
  color: #1e3a8a;
  box-shadow: 0 0 0 2px rgba(49, 94, 251, 0.12);
}

.otp-shell.active .otp-track {
  box-shadow: 0 0 0 2px rgba(27, 110, 243, 0.15);
}

.btn {
  display: block;
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #4d73ff 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(43, 89, 251, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #4b6eff 100%);
  transform: translateY(-1px);
}

.btn-ghost {
  margin-top: 0.5rem;
  background: #fff;
  color: #4b5563;
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

.hint.err { color: var(--err); }
.hint.ok { color: var(--ok); }
.hint.syncing {
  color: #9f1239;
  font-weight: 600;
}
.muted { opacity: 0.85; }

.user-info {
  font-size: 1.05rem;
  margin: 0 0 1rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 0.75rem 1.25rem;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 10px;
  color: #f8fafc;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  z-index: 100;
}

.toast.ok {
  background: #065f46;
  border-color: #34d399;
  color: #ecfdf5;
}

.toast.err {
  background: #7f1d1d;
  border-color: #f87171;
  color: #fee2e2;
}

.dashboard h2 { margin: 0 0 0.25rem; }
.dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.dashboard-head-main {
  min-width: 0;
  flex: 1;
}
.dashboard-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}
.dashboard-title-row h2 {
  margin: 0;
}
#step-work .dashboard-head .user-info {
  margin: 0;
}
.btn-logout { width: auto; min-width: 120px; }
.selected-resume-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.resume-chip-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.selected-resume-chip:hover {
  background: rgba(255, 255, 255, 0.2);
}

.resume-chip-switch {
  color: #dc2626;
  font-weight: 800;
  transition: opacity 0.15s ease;
}

.selected-resume-chip:hover .resume-chip-switch {
  opacity: 0.62;
}

.resume-block { margin: 1rem 0; }
.resume-cards {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.resume-card {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 1.1rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  min-height: 108px;
}
.resume-card:hover {
  border-color: #b6c4ff;
  transform: translateY(-1px) scale(1.005);
  box-shadow: 0 10px 20px rgba(16, 24, 40, 0.08);
}
.resume-card.selected {
  border-color: #7f9aff;
  background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px rgba(49, 94, 251, 0.14);
}
.resume-card-title {
  display: block;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}
.resume-card-meta {
  display: block;
  color: var(--muted);
  font-size: 1rem;
}
.resume-card-add {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 118px;
}
.resume-add-plus {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid #d0d8f0;
  color: #315efb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  font-size: 1.45rem;
  line-height: 1;
}

.work-grid {
  display: grid;
  grid-template-columns: 4.35rem minmax(min(240px, 100%), 300px) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: stretch;
  min-height: 0;
}

.work-chats-layout {
  display: none;
}

#step-work.work-mode-chats .work-grid {
  grid-template-columns: 4.35rem minmax(min(180px, 100%), 260px) minmax(min(200px, 100%), 300px) minmax(0, 1fr);
}

#step-work.work-mode-chats .work-col-side,
#step-work.work-mode-chats .work-main {
  display: none !important;
}

#step-work.work-mode-chats .work-chats-layout {
  display: contents;
}

#step-work.work-mode-chats .work-chats-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.75rem 0.85rem;
}

#step-work.work-mode-chats .work-chats-col-segments {
  grid-column: 2;
}

#step-work.work-mode-chats .work-chats-col-list {
  grid-column: 3;
}

#step-work.work-mode-chats .work-chats-col-thread {
  grid-column: 4;
}

#step-work.work-mode-funnel-chats .work-grid {
  grid-template-columns: 4.35rem minmax(min(200px, 100%), 280px) minmax(min(220px, 100%), 300px) minmax(0, 1fr);
  gap: 0.65rem;
}

#step-work.work-mode-funnel-chats .work-col-side {
  display: none !important;
}

#step-work.work-mode-funnel-chats .work-crm-funnel {
  display: flex;
  grid-column: 2;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem 0.85rem;
}

#step-work.work-mode-funnel-chats .work-main {
  display: none !important;
}

#step-work.work-mode-funnel-chats .work-chats-layout {
  display: contents;
}

#step-work.work-mode-funnel-chats .work-chats-col-segments {
  display: none !important;
}

#step-work.work-mode-funnel-chats .work-chats-col-list,
#step-work.work-mode-funnel-chats .work-chats-col-thread {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem 1.15rem;
}

#step-work.work-mode-funnel-chats .work-chats-col-list {
  grid-column: 3;
}

#step-work.work-mode-funnel-chats .work-chats-col-thread {
  grid-column: 4;
}

#step-work.work-mode-funnel-chats .work-funnel-chats-head {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #eef2f7;
}

#step-work.work-mode-funnel-chats .work-chats-col-title-default {
  display: none;
}

#step-work.work-mode-funnel-chats #funnel-chats-status {
  display: block;
  flex-shrink: 0;
  margin: 0 0 0.65rem;
}

.funnel-chat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: #f8fafc;
}

.funnel-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.funnel-legend-swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.funnel-legend-swatch.cat-v2-questions { background: #2563eb; }
.funnel-legend-swatch.cat-v2-contact-q { background: #0891b2; }
.funnel-legend-swatch.cat-v2-links { background: #7c3aed; }
.funnel-legend-swatch.cat-v2-form-replied { background: #0f766e; }
.funnel-legend-swatch.cat-v2-contacts { background: #059669; }
.funnel-legend-swatch.cat-v2-meeting { background: #0ea5e9; }
.funnel-legend-swatch.cat-v2-no-questions { background: #64748b; }
.funnel-legend-swatch.cat-v2-human { background: #ea580c; }
.funnel-legend-swatch.cat-v2-other { background: #b45309; }
.funnel-legend-swatch.cat-v2-reject { background: #dc2626; }

#step-work.work-mode-funnel-chats .work-chats-col-list .chats-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 0.55rem;
  padding: 0.2rem 0.45rem 0.45rem 0.15rem;
  margin-right: -0.25rem;
  scrollbar-gutter: stable;
}

#step-work.work-mode-funnel-chats .chat-thread-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

#step-work.work-mode-funnel-chats .chat-thread-body,
#step-work.work-mode-chats .chat-thread-body {
  flex: 1;
  min-height: 10rem;
}

#step-work.work-mode-funnel-chats .chat-thread-body {
  background: #f8fafc;
  border-radius: 12px;
  overflow: hidden;
}

#step-work.work-mode-funnel-chats .chat-compose {
  background: #fff;
  border-top: 1px solid #e8edf3;
  padding: 0.65rem 0.75rem;
  margin: 0;
}

#step-work.work-mode-funnel-chats .chat-compose--funnel-ai {
  padding: 0.55rem 0.65rem 0.7rem;
}

#step-work.work-mode-funnel-chats .chat-thread-messages {
  padding: 0.35rem 0.1rem 0.5rem;
  gap: 0.75rem;
  border-radius: 0;
  border: none;
  background: transparent;
  flex: 1;
  min-height: 8rem;
}

#step-work.work-mode-funnel-chats .chat-msg-bubble {
  max-width: min(82%, 38rem);
}

#step-work.work-mode-chats .work-chats-col-thread,
#step-work.work-mode-funnel-chats .work-chats-col-thread {
  padding-bottom: 0.9rem;
}

#step-work.work-mode-funnel-chats .chat-card {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  border-color: var(--border);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

#step-work.work-mode-funnel-chats .chat-card:hover {
  border-color: #b8c9f5;
  box-shadow: 0 4px 14px rgba(43, 89, 251, 0.08);
  transform: translateY(-1px);
}

#step-work.work-mode-funnel-chats .chat-card-head {
  margin-bottom: 0.35rem;
}

#step-work.work-mode-funnel-chats .chat-card-sub {
  margin-bottom: 0.4rem;
}

#step-work.work-mode-funnel-chats .chat-card-preview {
  margin-bottom: 0.45rem;
}

#step-work.work-mode-funnel-chats .chat-card-meta {
  gap: 0.35rem;
}

#panel-funnel.work-panel-scroll {
  padding: 0 0.55rem 0.85rem 0.55rem;
}

#panel-funnel .panel-funnel-title {
  margin-bottom: 0.35rem;
}

#panel-funnel .funnel-hint {
  margin-bottom: 0.95rem;
}

#panel-funnel .funnel-list {
  gap: 0.6rem;
  padding-right: 0.15rem;
}

.work-chats-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-bottom: 0.35rem;
}

.work-chats-col-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.work-chats-col-head .work-chats-col-title {
  margin-bottom: 0;
}

#step-work.work-mode-chats .chats-segment-bar {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#step-work.work-mode-chats .chats-segment-list {
  flex: 1;
  max-height: none;
  min-height: 0;
}

#step-work.work-mode-chats .work-chats-col-list .chats-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-thread-head {
  flex-shrink: 0;
  margin-bottom: 0;
}

.chat-thread-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.55rem 0.15rem 0.65rem;
  border: none;
  border-bottom: 1px solid #eef2f7;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  min-width: 0;
}

.chat-thread-head-text {
  min-width: 0;
  flex: 1 1 auto;
}

.chat-thread-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-sub {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-menu-btn,
.chat-thread-refresh-btn {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #94a3b8;
  box-shadow: none;
}

.chat-thread-menu-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
}

.chat-thread-menu-btn:hover:not(:disabled),
.chat-thread-refresh-btn:hover:not(:disabled) {
  color: #475569;
  background: #f8fafc;
  border-color: #d1d5db;
}

.chat-vacancy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
  width: auto;
  padding: 0.32rem 0.7rem;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: transparent;
  color: #2563eb;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  box-sizing: border-box;
  white-space: nowrap;
}

.chat-vacancy-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-vacancy-btn svg {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

.chat-vacancy-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.chat-thread-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-width: 0;
}

.chat-thread-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.15rem;
}

.chat-thread-meta-count {
  margin: 0;
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 600;
}

.chat-thread-meta-count.ok {
  color: #059669;
}

.chat-thread-meta-count.syncing {
  color: #9f1239;
}

.chat-thread-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-thread-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.35rem 0.1rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 0;
}

.chat-thread-empty {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
  font-size: 0.9rem;
}

.chat-thread-empty p {
  margin: 0;
  max-width: 22rem;
  line-height: 1.45;
}

.chat-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  width: 100%;
}

.chat-msg-row.is-in {
  justify-content: flex-start;
}

.chat-msg-row.is-out {
  justify-content: flex-end;
}

.chat-msg-avatar {
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
}

.chat-msg-avatar--in {
  background: #ede9fe;
  color: #7c3aed;
}

.chat-msg-avatar--out {
  background: #2563eb;
  color: #fff;
}

.chat-msg-date {
  align-self: center;
  margin: 0.35rem 0 0.15rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  background: #e8edf3;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.chat-msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: min(82%, 36rem);
  padding: 0.65rem 0.8rem 0.55rem;
  border-radius: 16px;
  border: none;
  box-shadow: none;
}

.chat-msg-bubble.is-in {
  background: #fff;
  border-left: 3px solid #8b5cf6;
  border-bottom-left-radius: 6px;
}

.chat-msg-bubble.is-out {
  background: #eff6ff;
  border-bottom-right-radius: 6px;
}

.chat-msg-author {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
}

.chat-msg-bubble.is-in .chat-msg-author {
  color: #7c3aed;
}

.chat-msg-bubble.is-out .chat-msg-author {
  color: #2563eb;
}

.chat-msg-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.88rem;
  color: #1e293b;
  word-break: break-word;
}

.chat-msg-text strong {
  font-weight: 700;
  color: inherit;
}

.chat-msg-text em {
  font-style: italic;
}

.chat-msg-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-top: 0.1rem;
}

.chat-msg-time {
  font-size: 0.68rem;
  color: #94a3b8;
  font-style: normal;
  line-height: 1;
}

.chat-msg-read {
  display: inline-flex;
  color: #2563eb;
  line-height: 0;
}

.chat-msg-read-icon {
  width: 0.95rem;
  height: 0.95rem;
}

.chat-compose {
  display: block;
  flex-shrink: 0;
  padding: 0.65rem 0 0;
  margin: 0;
  border-top: none;
  background: transparent;
}

.ai-reply-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem 0.8rem;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.08);
  overflow: hidden;
}

.ai-reply-panel__progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width 0.2s ease;
  z-index: 2;
}

.ai-reply-panel.is-generating .ai-reply-panel__head-btn,
.ai-reply-panel.is-generating .ai-reply-chip {
  pointer-events: none;
  opacity: 0.65;
}

.ai-reply-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.ai-reply-panel__title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.ai-reply-panel__spark {
  display: inline-flex;
  color: #2563eb;
}

.ai-reply-panel__spark svg {
  width: 1.1rem;
  height: 1.1rem;
}

.ai-reply-panel__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1d4ed8;
}

.ai-reply-panel__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #3b82f6;
  font-size: 0.72rem;
  font-weight: 600;
}

.ai-reply-panel__head-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.ai-reply-panel__head-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.45rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.ai-reply-panel__head-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.ai-reply-panel__head-btn svg {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}

.ai-reply-panel__head-btn--icon {
  padding: 0.35rem;
}

.ai-reply-panel__editor-box {
  width: 100%;
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.ai-reply-panel__editor-box:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-reply-panel__editor-wrap {
  align-items: stretch;
}

.chat-compose--funnel-ai .chat-compose-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-reply-panel__editor,
.chat-compose--funnel-ai .ai-reply-panel__editor,
.chat-compose--funnel-ai .chat-compose-input.input {
  display: block;
  flex: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 8.5rem;
  max-height: 20rem;
  margin: 0;
  resize: vertical;
  border: none;
  border-radius: 0;
  padding: 0.9rem 1rem;
  font-size: 0.92rem;
  line-height: 1.55;
  box-sizing: border-box;
  background: transparent;
  box-shadow: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow-y: auto;
}

.chat-compose--funnel-ai .ai-reply-panel__editor-box {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.ai-reply-panel--expanded .ai-reply-panel__editor {
  min-height: 13rem;
  max-height: 28rem;
}

.ai-reply-panel__editor:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.ai-reply-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ai-reply-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.7rem;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #f8fbff;
  color: #2563eb;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ai-reply-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.ai-reply-chip svg {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.ai-reply-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ai-reply-panel__hint {
  margin: 0;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.35;
}

.form-fill-panel {
  position: relative;
  display: none;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 55%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  z-index: 5;
  overflow: hidden;
}

.form-fill-panel:not(.hidden) {
  display: flex;
}

.form-fill-panel.hidden {
  display: none !important;
}

/* Form preview replaces composer + takes full thread body for readability */
.chat-thread-body:has(#form-fill-panel:not(.hidden)) .chat-thread-messages {
  display: none;
}

.chat-thread-body:has(#form-fill-panel:not(.hidden)) .chat-compose {
  display: none !important;
}

.chat-thread-body:has(#form-fill-panel:not(.hidden)) .form-fill-panel {
  max-height: none;
  flex: 1 1 auto;
  border-radius: 12px;
}

.form-fill-panel__progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #3b82f6, #0ea5e9);
  transition: width 0.25s ease;
  z-index: 3;
}

.form-fill-panel.is-loading .form-fill-panel__scroll,
.form-fill-panel.is-loading .form-fill-panel__foot {
  display: none;
}

.form-fill-panel__loading {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-height: 10rem;
  padding: 1.25rem 0.5rem 1.5rem;
}

.form-fill-panel__loading.hidden {
  display: none !important;
}

.form-fill-panel__loading-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  text-align: center;
}

.form-fill-panel__loading-hint {
  margin: 0;
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
}

.form-fill-panel__bar {
  width: min(100%, 22rem);
  height: 8px;
  margin: 0 auto;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.form-fill-panel__bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.3s ease;
}

.form-fill-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.form-fill-panel__title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.form-fill-panel__title {
  font-size: 0.92rem;
  font-weight: 650;
  color: #0f172a;
}

.form-fill-panel__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #e8f0fe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 600;
}

.form-fill-panel__close {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.form-fill-panel__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-right: 0.2rem;
}

.form-fill-panel__meta {
  margin: 0;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.4;
}

.form-fill-panel__pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #f8fbff 70%, rgba(248, 251, 255, 0));
  padding-bottom: 0.2rem;
}

.form-fill-page-btn {
  border: 1px solid #dbeafe;
  background: #fff;
  color: #1e40af;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.form-fill-page-btn.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.form-fill-panel__answers {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.form-fill-answer {
  padding: 0.55rem 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.form-fill-answer__q {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}

.form-fill-answer__a {
  width: 100%;
  min-height: 2.4rem;
  resize: vertical;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font: inherit;
  font-size: 0.86rem;
  color: #0f172a;
  background: #f8fafc;
}

.form-fill-answer__a:focus {
  outline: none;
  border-color: #93c5fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-fill-answer__meta {
  margin: 0.3rem 0 0;
  font-size: 0.7rem;
  color: #94a3b8;
}

.form-fill-panel__note {
  margin: 0;
  font-size: 0.75rem;
  color: #b45309;
  line-height: 1.35;
}

.form-fill-panel__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  flex: 0 0 auto;
  padding-top: 0.35rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.chat-form-fill-btn {
  display: inline-flex !important;
}

.chat-form-fill-btn.hidden {
  display: none !important;
}

.chat-form-fill-btn span {
  white-space: nowrap;
}

.chat-form-fill-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ai-reply-panel__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.32);
}

.ai-reply-panel__send svg {
  width: 1.05rem;
  height: 1.05rem;
}

.chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel__funnel-only {
  display: none !important;
}

.chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel {
  padding: 0;
  border: 1px solid #e8edf3;
  border-radius: 14px;
  box-shadow: none;
  gap: 0;
  background: #fff;
  overflow: hidden;
}

.chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel__editor-box {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: hidden;
}

.chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel__editor,
.chat-compose:not(.chat-compose--funnel-ai) .chat-compose-input.input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  max-height: 6.5rem;
  height: auto;
  margin: 0;
  padding: 0.75rem 0.9rem 0.35rem;
  border: none;
  border-radius: 0;
  resize: none;
  overflow-y: auto;
  background: #fff;
  box-shadow: none;
  font-size: 0.92rem;
  line-height: 1.45;
  font-family: inherit;
}

.chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel__foot {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 0;
  padding: 0.35rem 0.55rem 0.55rem;
  border-top: none;
  background: #fff;
}

.chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel__hint {
  display: block;
  margin: 0;
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
}

.chat-compose--funnel-ai .ai-reply-panel__editor.input {
  margin-bottom: 0;
}

.chat-compose--funnel-ai .ai-reply-panel__funnel-only {
  display: flex;
}

.chat-compose--funnel-ai .ai-reply-panel__chips.ai-reply-panel__funnel-only {
  display: flex;
}

.chat-compose .btn-ai-reply {
  width: 100%;
  margin: 0 0 0.55rem;
}

.chat-compose-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
}

.chat-compose-input.input {
  margin-bottom: 0;
}

.chat-compose:not(.chat-compose--funnel-ai) .chat-compose-input:focus,
.chat-compose:not(.chat-compose--funnel-ai) .chat-compose-input.input:focus,
.chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel__editor:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.chat-compose-send,
.chat-compose .chat-compose-send.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.65rem;
  height: 2.65rem;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.32);
}

.chat-compose-send svg {
  width: 1.05rem;
  height: 1.05rem;
  margin-left: 0.05rem;
  flex-shrink: 0;
}

.chat-compose-send-label {
  display: none;
}

.chat-compose-send:disabled {
  opacity: 0.65;
}

/* legacy aliases */
.chat-msg {
  border: 1px solid #e8ebf5;
  background: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  max-width: 92%;
  align-self: flex-start;
}

.chat-msg.out {
  align-self: flex-end;
  border-color: #bfd0ff;
  background: #eef3ff;
}

.chat-msg-head {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 0.25rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
}

.chat-msg-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.4;
  font-size: 0.88rem;
  color: #0f172a;
}

button.chat-card {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  appearance: none;
}

button.chat-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chat-card.selected {
  border-color: var(--accent);
  background: #f0f4ff;
  box-shadow: 0 0 0 2px rgba(43, 89, 251, 0.14);
}
.work-main, .work-side {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
}
.work-main {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
}
.cover-run-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(6.5rem, 7rem);
  grid-template-rows: minmax(3.75rem, 4rem);
  gap: 0.55rem;
  align-items: stretch;
  flex: 0 0 auto;
}
.work-main-cover {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 0 0 auto;
}
.work-panel-side {
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
.logs-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f9fbff;
  flex: 1 1 0;
  min-height: 140px;
  overflow: auto;
  margin-bottom: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

.work-panel-side::-webkit-scrollbar,
.logs-box::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.work-panel-side::-webkit-scrollbar-track,
.logs-box::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #f5f8ff 0%, var(--scroll-track) 100%);
  border-radius: 999px;
}

.work-panel-side::-webkit-scrollbar-thumb,
.logs-box::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scroll-thumb) 0%, #9fb3f0 100%);
  border-radius: 999px;
  border: 2px solid var(--scroll-track);
}

.work-panel-side::-webkit-scrollbar-thumb:hover,
.logs-box::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scroll-thumb-hover) 0%, #7f9bed 100%);
}

.work-panel-side::-webkit-scrollbar-thumb:active,
.logs-box::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, var(--scroll-thumb-active) 0%, #5f82e3 100%);
}

.logs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  min-width: 40rem;
}

.logs-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 0.6rem 0.6rem;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: #64748b;
  background: #f4f6f9;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.logs-table tbody td {
  padding: 0.52rem 0.55rem;
  border-bottom: 1px dashed #d4dce8;
  vertical-align: top;
}

.logs-table .log-col-cover {
  min-width: 220px;
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
  font-size: 0.78rem;
  line-height: 1.45;
}

.logs-table tbody tr:nth-child(even) td {
  background: #fcfdff;
}

.logs-table tbody tr:hover td {
  background: #f2f6ff;
}

.tab-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.tab-row-three .tab-btn {
  flex: 1;
  font-size: 0.82rem;
  padding: 0.4rem 0.25rem;
}
.chats-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.chats-toolbar-label { margin: 0; }
.btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}
.chats-status {
  margin: 0 0 0.5rem;
  min-height: 1.1em;
}
.chats-status.syncing {
  color: #9f1239;
  font-weight: 600;
}

#step-work.work-mode-funnel-chats #funnel-chats-status.syncing,
#step-work.work-mode-chats .chats-status.syncing {
  color: #9f1239;
}

.chats-load-banner {
  position: fixed;
  left: 50%;
  bottom: 0.85rem;
  z-index: 80;
  transform: translateX(-50%);
  width: min(28rem, calc(100vw - 1.5rem));
  margin: 0;
  padding: 0.4rem 0.65rem 0.45rem;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: rgba(254, 226, 226, 0.96);
  box-shadow: 0 8px 24px rgba(127, 29, 29, 0.12);
  overflow: hidden;
  pointer-events: none;
}

.chats-load-banner__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.3rem;
}

.chats-load-banner__text {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: #9f1239;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chats-load-banner__pct {
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 800;
  color: #7f1d1d;
  font-variant-numeric: tabular-nums;
}

.chats-load-banner__hint {
  display: none;
}

.chats-load-banner__track {
  height: 0.22rem;
  border-radius: 999px;
  background: #fecaca;
  overflow: hidden;
  border: none;
}

.chats-load-banner__bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: #991b1b;
  transition: width 0.35s ease;
}

.chats-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.chats-metric {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  background: #fbfcff;
  color: inherit;
  font: inherit;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.chats-metric:hover {
  border-color: #c6d2f7;
  box-shadow: 0 1px 0 rgba(49, 94, 251, 0.08);
}
.chats-metric.active {
  border-color: #8ca7ff;
  box-shadow: 0 0 0 2px rgba(49, 94, 251, 0.12);
  transform: translateY(-1px);
}
.chats-metric.cat-v2-questions { border-left: 3px solid #2563eb; }
.chats-metric.cat-v2-contact-q { border-left: 3px solid #0891b2; }
.chats-metric.cat-v2-links { border-left: 3px solid #7c3aed; }
.chats-metric.cat-v2-form-replied { border-left: 3px solid #0f766e; }
.chats-metric.cat-v2-contacts { border-left: 3px solid #059669; }
.chats-metric.cat-v2-meeting { border-left: 3px solid #0ea5e9; }
.chats-metric.cat-v2-no-questions { border-left: 3px solid #64748b; }
.chats-metric.cat-v2-human { border-left: 3px solid #ea580c; }
.chats-metric.cat-v2-reject { border-left: 3px solid #dc2626; }
.chats-metric.cat-v2-other { border-left: 3px solid #b45309; }
/* legacy metric tones */
.chats-metric.cat-ai { border-left: 3px solid #8b5cf6; }
.chats-metric.cat-human-q { border-left: 3px solid #2563eb; }
.chats-metric.cat-human-noq { border-left: 3px solid #64748b; }
.chats-metric.cat-no-reply { border-left: 3px solid #b45309; }
.chats-metric.cat-interview { border-left: 3px solid #059669; }
.chats-metric.cat-discard { border-left: 3px solid #dc2626; }
.chats-metric.cat-forms { border-left: 3px solid #7c3aed; }
.chats-metric-name {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  line-height: 1.2;
}
.chats-metric-val {
  display: block;
  font-size: 0.86rem;
  color: #1f2937;
  font-weight: 700;
}
.chats-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.chat-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.55rem 0.65rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.chat-card:hover {
  border-color: #8ca7ff;
  background: #f7f9ff;
}
.chat-card.unread {
  border-color: #6d8cff;
  background: #f0f4ff;
}
.chat-card.needs-reply {
  box-shadow: inset 4px 0 0 #3b6cff;
}
.chat-card.cat-v2-questions {
  border-left: 4px solid #2563eb;
  background: linear-gradient(90deg, #eff6ff 0%, #fff 38%);
}
.chat-card.cat-v2-contact-q {
  border-left: 4px solid #0891b2;
  background: linear-gradient(90deg, #ecfeff 0%, #fff 38%);
}
.chat-card.cat-v2-links {
  border-left: 4px solid #7c3aed;
  background: linear-gradient(90deg, #f5f3ff 0%, #fff 38%);
}
.chat-card.cat-v2-form-replied {
  border-left: 4px solid #0f766e;
  background: linear-gradient(90deg, #f0fdfa 0%, #fff 38%);
}
.chat-card.cat-v2-contacts {
  border-left: 4px solid #059669;
  background: linear-gradient(90deg, #ecfdf5 0%, #fff 38%);
}
.chat-card.cat-v2-meeting {
  border-left: 4px solid #0ea5e9;
  background: linear-gradient(90deg, #f0f9ff 0%, #fff 38%);
}
.chat-card.cat-v2-no-questions {
  border-left: 4px solid #64748b;
  background: linear-gradient(90deg, #f8fafc 0%, #fff 38%);
}
.chat-card.cat-v2-human {
  border-left: 4px solid #ea580c;
  background: linear-gradient(90deg, #fff7ed 0%, #fff 38%);
}
.chat-card.cat-v2-reject {
  border-left: 4px solid #dc2626;
  background: linear-gradient(90deg, #fef2f2 0%, #fff 38%);
  opacity: 0.92;
}
.chat-card.cat-v2-other {
  border-left: 4px solid #b45309;
  background: linear-gradient(90deg, #fffbeb 0%, #fff 38%);
}
/* legacy */
.chat-card.cat-ai { border-left: 4px solid #8b5cf6; background: #faf5ff; }
.chat-card.cat-human-q { border-left: 4px solid #2563eb; background: #eff6ff; }
.chat-card.cat-human-noq { border-left: 4px solid #64748b; background: #f8fafc; }
.chat-card.cat-no-reply { border-left: 4px solid #b45309; background: #fffbeb; }
.chat-card.cat-interview { border-left: 4px solid #059669; background: #ecfdf5; }
.chat-card.cat-discard { border-left: 4px solid #dc2626; background: #fef2f2; }
.chat-card.cat-forms { border-left: 4px solid #7c3aed; background: #f5f3ff; }
.chat-card-title {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.3;
  margin: 0 0 0.15rem;
}
.chat-card-sub {
  font-size: 0.8rem;
  color: #475569;
  margin: 0 0 0.35rem;
}
.chat-card-preview {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
  align-items: center;
}
.chat-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
}
.chat-badge.warn {
  background: #fff4e5;
  color: #9a5b00;
}
.chat-badge.accent {
  background: #dce8ff;
  color: #1d4ed8;
}
.chat-badge.cat-v2-questions { background: #dbeafe; color: #1d4ed8; }
.chat-badge.cat-v2-contact-q { background: #cffafe; color: #0e7490; }
.chat-badge.cat-v2-links { background: #ede9fe; color: #6d28d9; }
.chat-badge.cat-v2-form-replied { background: #ccfbf1; color: #0f766e; }
.chat-badge.cat-v2-contacts { background: #d1fae5; color: #047857; }
.chat-badge.cat-v2-meeting { background: #e0f2fe; color: #0369a1; }
.chat-badge.cat-v2-no-questions { background: #e2e8f0; color: #334155; }
.chat-badge.cat-v2-human { background: #ffedd5; color: #c2410c; }
.chat-badge.cat-v2-reject { background: #fee2e2; color: #b91c1c; }
.chat-badge.cat-v2-other { background: #fef3c7; color: #92400e; }
.chat-badge.cat-ai { background: #efe5ff; color: #6d28d9; }
.chat-badge.cat-human-q { background: #dbeafe; color: #1d4ed8; }
.chat-badge.cat-human-noq { background: #e2e8f0; color: #334155; }
.chat-badge.cat-no-reply { background: #fef3c7; color: #92400e; }
.chat-badge.cat-interview { background: #d1fae5; color: #047857; }
.chat-badge.cat-discard { background: #fee2e2; color: #b91c1c; }
.chat-badge.cat-forms { background: #ede9fe; color: #6d28d9; }
.chats-empty {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.75rem 0;
  text-align: center;
}
.tab-btn {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 0.45rem;
  cursor: pointer;
}
.tab-btn.active {
  color: var(--text);
  border-color: #8ca7ff;
  background: #edf2ff;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 0.65rem;
}

.cover-letter {
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  margin-bottom: 0;
}
.cover-run-row .btn-run {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: 0.4rem 0.45rem;
  font-size: 0.82rem;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border-radius: 0 10px 10px 0;
}

.btn-run-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}

.btn-run-icon svg {
  width: 0.7rem;
  height: 0.7rem;
  margin-left: 1px;
}

.btn-run-label {
  font-weight: 700;
}

.btn-ai-cover {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-bottom: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
}

.btn-ai-cover:disabled {
  opacity: 1;
  cursor: wait;
}

.btn-ai-cover.is-generating:disabled {
  opacity: 1;
  transform: none;
  box-shadow: 0 8px 20px rgba(43, 89, 251, 0.22);
}

.btn-ai-cover-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.32);
  transition: width 0.25s ease-out;
  pointer-events: none;
  z-index: 0;
}

.btn-ai-cover-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}

.btn-ai-cover svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.work-main-cover .btn-primary {
  margin-bottom: 0;
}

.check-info-icon {
  width: 0.9rem;
  height: 0.9rem;
  color: #94a3b8;
  flex-shrink: 0;
  margin-left: 0.15rem;
}

.work-footer-note {
  display: none !important;
}
.check-row-last {
  margin-bottom: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 0.65rem;
  cursor: pointer;
  user-select: none;
}

.toggle-row-text {
  line-height: 1.35;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 2.6rem;
  height: 1.45rem;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.toggle-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.45rem - 6px);
  height: calc(1.45rem - 6px);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-switch-track::after {
  transform: translateX(1.15rem);
}

.toggle-switch input:focus-visible + .toggle-switch-track {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.toggle-switch input:disabled + .toggle-switch-track {
  opacity: 0.55;
  cursor: not-allowed;
}

.work-cover-card .toggle-row {
  margin-top: 0.15rem;
  margin-bottom: 0;
}

.run-row {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 0 auto;
}
.run-note {
  color: var(--muted);
  font-size: 0.85rem;
  flex: 1;
}
.btn-run {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(34, 197, 94, 0.28);
}
.btn-run.running {
  background: linear-gradient(135deg, #ee8f2b 0%, #ffb24a 100%);
  box-shadow: 0 10px 26px rgba(240, 143, 45, 0.35);
}

#step-resume .dashboard-head {
  background: transparent;
  border-radius: 0;
  padding: 0 0 0.75rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}

#step-resume .dashboard-head h2 {
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
  color: #111827;
}

#step-resume .dashboard-head .user-info {
  color: var(--muted);
  margin: 0.45rem 0 0;
}

#step-resume .dashboard-head .btn-logout {
  background: #fff;
  color: #4b5563;
  border: 1px solid var(--border);
  margin-top: 0;
}

/* ?? Work screen (?????? ????????) ?? */
.work-app {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

#step-work .dashboard-head.work-topbar {
  display: block;
  width: 100%;
}

.work-topbar {
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--panel-shadow);
  padding: 0.65rem 1rem;
  margin-bottom: 0.45rem;
  color: var(--text);
  box-sizing: border-box;
}

.work-topbar__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1.25rem 1.5rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.work-topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  grid-column: 1;
}

.work-topbar__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.work-topbar__eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}

.work-topbar__user {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-logo {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: transparent url("/img/otclicks-mark.png?v=3") center / 92% no-repeat;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-logo::after {
  content: none;
}

.work-resume-btn,
.work-topbar .selected-resume-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}

.work-resume-btn:hover,
.work-topbar .selected-resume-chip:hover {
  color: var(--accent);
  background: none;
  border: none;
}

.work-resume-btn .resume-chip-title,
.work-topbar .selected-resume-chip .resume-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.work-topbar__stats {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0.2rem 0;
  background: transparent;
  border: none;
  border-radius: 0;
  flex-shrink: 0;
  grid-column: 2;
  justify-self: end;
}

.work-stat,
.user-metric-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 4.75rem;
  padding: 0.35rem 0.65rem;
  text-align: center;
}

.work-stat + .work-stat {
  border-left: 1px solid var(--border);
}

.work-stat__value,
.user-metric-value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.work-stat--accent .work-stat__value,
.user-metric-card.user-metric-primary .user-metric-value {
  color: var(--accent);
}

.work-stat__label,
.user-metric-label {
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
}

.work-stat--muted .work-stat__value,
.user-metric-card.user-metric-stub .user-metric-value {
  color: #c4c9d4;
  font-size: 1rem;
  font-weight: 700;
}

.work-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  grid-column: 3;
  justify-self: end;
}

.work-action-btn,
.btn-switch-resume {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 2.25rem;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.work-action-btn svg,
.btn-switch-resume svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.work-action-btn:hover,
.btn-switch-resume:hover {
  background: #f8fafc;
  border-color: #c5ced9;
  color: var(--text);
}

.work-action-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.work-action-btn--ghost:hover {
  background: #f3f4f6;
  border-color: transparent;
  color: var(--text);
}

.work-topbar-logout {
  margin: 0;
  width: auto;
  min-width: 0;
}

.work-topbar .resume-chip-switch {
  display: none;
}

.work-btn-outline {
  width: auto;
  margin-top: 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-control);
  background: #fff;
  color: #374151;
  border: 1px solid var(--border-strong);
}

.work-btn-outline:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #c5ced9;
  color: var(--text);
}

@media (max-width: 1100px) {
  .work-topbar__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "stats stats";
    gap: 0.65rem 0.75rem;
    align-items: start;
  }

  .work-topbar__brand { grid-area: brand; }
  .work-topbar__actions {
    grid-area: actions;
    justify-self: end;
    align-self: start;
    padding-top: 0.1rem;
    margin-left: 0;
  }
  .work-topbar__stats {
    grid-area: stats;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }
}

.work-layout {
  flex: 1;
  min-height: 0;
}

.work-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--card);
  box-shadow: var(--panel-shadow);
  min-height: 0;
}

.work-panel-side {
  padding: 0.85rem 0.55rem 0.85rem 0.85rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.work-side-heading {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.work-panel-main {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: 100%;
  min-height: 0;
}

.work-main-logs-title,
.work-cover-title {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.panel-block-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.55rem;
}

.work-col-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ???????????? rail ? ??? ?? ????????? (??????????? ???????, ??? ??????? ?????) */
.work-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
  justify-content: flex-start;
  gap: 1.15rem;
  width: 4.35rem;
  height: auto;
  padding: 1.15rem 0.4rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--panel-shadow);
  flex-shrink: 0;
}

.work-rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  width: 100%;
  padding: 0.62rem 0.25rem;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.work-rail-btn .tab-btn-label {
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}

.work-rail-btn .tab-icon {
  color: inherit;
}

.work-rail .work-rail-btn.active,
.work-tabs-nav .work-rail-btn.active,
.work-tabs-nav .tab-btn.work-rail-btn.active {
  background: #eff6ff;
  color: #2563eb;
  box-shadow: none;
}

.work-rail .work-rail-btn.active .tab-icon,
.work-tabs-nav .work-rail-btn.active .tab-icon {
  color: #2563eb;
}

.work-rail-btn-bottom {
  margin-top: 0;
}

@media (min-width: 981px) {
  .work-rail #tab-settings,
  .work-rail .tab-btn-apply {
    display: none !important;
  }
}

.work-tabs-nav .tab-btn {
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.42rem 0.35rem;
  border: none;
  background: transparent;
  color: #64748b;
}

.work-tabs-nav .tab-btn.active {
  background: #eef2ff;
  color: var(--accent);
  box-shadow: none;
}

.tab-btn-apply {
  display: none;
}

.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  line-height: 0;
}

.tab-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
  overflow: visible;
}

.chats-summary-metrics {
  display: none !important;
}

.funnel-hint {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
}

.funnel-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.funnel-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.62rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.funnel-item:hover {
  border-color: #dbeafe;
  background: #f8faff;
}

.funnel-item.is-active {
  border-color: #93c5fd;
  background: #eef4ff;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.12);
}

.funnel-item-step {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.32rem;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}

.funnel-item-name {
  flex: 1;
  min-width: 0;
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: manual;
}

.funnel-item-count {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 1.55rem;
  margin-top: 0.05rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #e8edf4;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  border: 1px solid #d5dde8;
}

.funnel-tone-applies .funnel-item-step { background: #6366f1; }
.funnel-tone-reply .funnel-item-step { background: #0d9488; }
.funnel-tone-questions .funnel-item-step { background: #2563eb; }
.funnel-tone-forms .funnel-item-step { background: #8b5cf6; }
.funnel-tone-form-replied .funnel-item-step { background: #0f766e; }
.funnel-tone-contacts .funnel-item-step { background: #10b981; }
.funnel-tone-meeting .funnel-item-step { background: #0ea5e9; }

.funnel-tone-applies .funnel-item-count { background: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }
.funnel-tone-reply .funnel-item-count { background: #ccfbf1; color: #0f766e; border-color: #99f6e4; }
.funnel-tone-questions .funnel-item-count { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.funnel-tone-forms .funnel-item-count { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
.funnel-tone-form-replied .funnel-item-count { background: #ccfbf1; color: #0f766e; border-color: #99f6e4; }
.funnel-tone-contacts .funnel-item-count { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.funnel-tone-meeting .funnel-item-count { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.funnel-tone-reject .funnel-item-step { background: #dc2626; }
.funnel-tone-reject .funnel-item-count { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

.funnel-item.is-active .funnel-item-count {
  background: #fff;
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.chats-segment-bar {
  margin-bottom: 0.45rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.chats-segment-heading {
  margin: 0 0 0.2rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

.chats-segment-hint {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #94a3b8;
}

.chats-list-heading {
  margin: 0 0 0.35rem;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.chats-segment-search-wrap {
  position: relative;
  margin-bottom: 0.45rem;
}

.chats-segment-search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.95rem;
  height: 0.95rem;
  color: #94a3b8;
  pointer-events: none;
}

.chats-segment-search {
  margin-bottom: 0;
  padding: 0.55rem 0.65rem 0.55rem 2.15rem;
  font-size: 0.88rem;
  border-radius: 10px;
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.chats-segment-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chats-segment-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(340px, 46vh);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  padding: 0.15rem 0.2rem 0.15rem 0;
}

.chats-segment-item {
  --seg-color: #64748b;
  --seg-bg: #f8fafc;
  --seg-bg-hover: #f1f5f9;
  --seg-bg-active: #eef2f6;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.55rem 0.5rem 0.5rem;
  border: 1px solid #e8ecf2;
  border-radius: 11px;
  background: #fff;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s, transform 0.12s;
}

.chats-segment-item::before {
  content: '';
  flex-shrink: 0;
  width: 3px;
  align-self: stretch;
  min-height: 1.4rem;
  border-radius: 4px;
  background: var(--seg-color);
  opacity: 0.85;
}

.chats-segment-item:hover {
  background: var(--seg-bg-hover);
  border-color: color-mix(in srgb, var(--seg-color) 35%, #e8ecf2);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--seg-color) 12%, transparent);
}

.chats-segment-item.active {
  background: var(--seg-bg-active);
  border-color: color-mix(in srgb, var(--seg-color) 45%, #e8ecf2);
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--seg-color) 22%, transparent),
    0 3px 10px color-mix(in srgb, var(--seg-color) 14%, transparent);
}

.chats-segment-item.active::before {
  opacity: 1;
  width: 4px;
}

.chats-segment-item.hidden-by-search {
  display: none;
}

.chats-segment-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.chats-segment-item-count {
  flex-shrink: 0;
  min-width: 1.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--seg-color) 12%, #f1f5f9);
  color: color-mix(in srgb, var(--seg-color) 72%, #475569);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  letter-spacing: -0.02em;
}

.chats-segment-item.active .chats-segment-item-count {
  background: color-mix(in srgb, var(--seg-color) 22%, #fff);
  color: color-mix(in srgb, var(--seg-color) 88%, #0f172a);
}

.chats-segment-item.seg-tone-all {
  --seg-color: #64748b;
  --seg-bg-hover: #f8fafc;
  --seg-bg-active: #f1f5f9;
}

.chats-segment-item.seg-tone-questions {
  --seg-color: #2563eb;
  --seg-bg-hover: #eff6ff;
  --seg-bg-active: #dbeafe;
}

.chats-segment-item.seg-tone-contact-questions {
  --seg-color: #0891b2;
  --seg-bg-hover: #ecfeff;
  --seg-bg-active: #cffafe;
}

.chats-segment-item.seg-tone-links {
  --seg-color: #7c3aed;
  --seg-bg-hover: #f5f3ff;
  --seg-bg-active: #ede9fe;
}

.chats-segment-item.seg-tone-contacts {
  --seg-color: #059669;
  --seg-bg-hover: #ecfdf5;
  --seg-bg-active: #d1fae5;
}

.chats-segment-item.seg-tone-meeting {
  --seg-color: #0ea5e9;
  --seg-bg-hover: #f0f9ff;
  --seg-bg-active: #e0f2fe;
}

.chats-segment-item.seg-tone-no-questions {
  --seg-color: #64748b;
  --seg-bg-hover: #f8fafc;
  --seg-bg-active: #f1f5f9;
}

.chats-segment-item.seg-tone-human {
  --seg-color: #ea580c;
  --seg-bg-hover: #fff7ed;
  --seg-bg-active: #ffedd5;
}

.chats-segment-item.seg-tone-reject {
  --seg-color: #dc2626;
  --seg-bg-hover: #fef2f2;
  --seg-bg-active: #fee2e2;
}

.chats-segment-item.seg-tone-other {
  --seg-color: #b45309;
  --seg-bg-hover: #fffbeb;
  --seg-bg-active: #fef3c7;
}

.chats-segment-item.seg-tone-forms {
  --seg-color: #7c3aed;
  --seg-bg-hover: #f5f3ff;
  --seg-bg-active: #ede9fe;
}

.chats-segment-select {
  margin-bottom: 0;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.65rem 0.75rem;
}

.work-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 0 0.65rem 0.85rem 0.15rem;
  margin-right: -0.15rem;
}

.work-panel-scroll .input,
.work-panel-scroll .check-row {
  margin-bottom: 0.6rem;
}

.work-panel-scroll .panel-filters-title {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 0.65rem;
  padding: 0.15rem 0 0.5rem;
  background: linear-gradient(180deg, #fff 75%, rgba(255, 255, 255, 0));
}

#panel-links:not(.hidden),
#panel-filters:not(.hidden) {
  display: flex !important;
  flex-direction: column;
}

.links-resume-hint {
  margin: -0.35rem 0 0.65rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted, #64748b);
}

#links-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.link-input-resume {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(180deg, #f8fbff 0%, #f1f5f9 100%);
}

#step-work.work-mode-chats .chats-status,
#step-work.work-mode-chats .chats-segment-bar {
  flex-shrink: 0;
}

.tab-btn-label {
  display: inline;
}

#step-work.work-mode-chats .chats-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

#step-work.work-mode-chats .chats-metric {
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: #f8fafc;
}

#step-work.work-mode-chats .chats-metric-val {
  font-size: 1.05rem;
  color: var(--text);
}

#step-work.work-mode-chats .chats-list {
  gap: 0.5rem;
}

#step-work.work-mode-chats .chat-card {
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  border-color: var(--border);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

#step-work.work-mode-chats .chat-card:hover {
  border-color: #b8c9f5;
  box-shadow: 0 4px 14px rgba(43, 89, 251, 0.08);
  transform: translateY(-1px);
}

.chat-card-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
}

.chat-card-dot {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  margin-top: 0;
  background: #94a3b8;
}

.chat-card.cat-v2-questions .chat-card-dot { background: #2563eb; }
.chat-card.cat-v2-contact-q .chat-card-dot { background: #0891b2; }
.chat-card.cat-v2-links .chat-card-dot { background: #7c3aed; }
.chat-card.cat-v2-contacts .chat-card-dot { background: #059669; }
.chat-card.cat-v2-meeting .chat-card-dot { background: #0ea5e9; }
.chat-card.cat-v2-no-questions .chat-card-dot { background: #64748b; }
.chat-card.cat-v2-human .chat-card-dot { background: #ea580c; }
.chat-card.cat-v2-reject .chat-card-dot { background: #dc2626; }
.chat-card.cat-v2-other .chat-card-dot { background: #b45309; }
.chat-card.cat-human-q .chat-card-dot { background: #2563eb; }
.chat-card.cat-forms .chat-card-dot { background: #7c3aed; }
.chat-card.cat-interview .chat-card-dot { background: #059669; }
.chat-card.cat-human-noq .chat-card-dot { background: #64748b; }
.chat-card.cat-no-reply .chat-card-dot { background: #b45309; }
.chat-card.cat-discard .chat-card-dot { background: #dc2626; }
.chat-card.cat-ai .chat-card-dot { background: #8b5cf6; }
.chat-card.needs-reply .chat-card-dot { background: var(--accent); }

.chat-card-head .chat-card-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.chat-card-time {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
  margin-top: 0.15rem;
}

.work-logs-card {
  border-radius: 12px;
  border-color: var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
}

.logs-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  text-align: center;
  min-height: 120px;
}

.logs-empty-state.hidden {
  display: none;
}

.logs-empty-illustration {
  width: 7.5rem;
  height: auto;
  margin-bottom: 1rem;
}

.logs-empty-illustration svg {
  width: 100%;
  height: auto;
  display: block;
}

.logs-empty-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.logs-empty-sub {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  max-width: 22em;
  line-height: 1.45;
}

.logs-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.logs-table-wrap.hidden {
  display: none;
}

.logs-cards-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.6rem 0.65rem;
  overflow: hidden;
}

.logs-cards-wrap.hidden {
  display: none;
}

.logs-cards-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.logs-cards-heading {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.logs-cards-count {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #eef2f7;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logs-cards {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-content: start;
  padding-right: 0.1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

.process-card {
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  box-shadow: none;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
}

.process-card-icon {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  align-self: center;
}

.process-card-icon svg {
  width: 0.95rem;
  height: 0.95rem;
}

.process-card-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.08rem;
  align-self: center;
}

.process-card-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.process-card-time {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 550;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.process-card-sub {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.process-card-side {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  align-self: center;
}

.process-status {
  display: inline-flex;
  align-items: center;
  max-width: 9.5rem;
  height: 1.55rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.process-status--ok {
  background: #ecfdf5;
  color: #059669;
}

.process-status--warn {
  background: #fff7ed;
  color: #c2410c;
}

.process-status--danger {
  background: #fef2f2;
  color: #dc2626;
}

.process-status--info {
  background: #eff6ff;
  color: #2563eb;
}

.process-status--muted {
  background: #f1f5f9;
  color: #94a3b8;
}

.process-card-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.55rem;
  padding: 0 0.55rem;
  border-radius: 8px;
  border: 1px solid #93c5fd;
  color: #2563eb;
  background: #fff;
  font-size: 0.7rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.process-card-open:hover {
  background: #eff6ff;
}

.work-cover-card {
  margin-top: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.7rem 0.65rem;
  flex-shrink: 0;
}

.work-cover-card .cover-run-row {
  border-radius: 10px;
  overflow: hidden;
}

.work-cover-card .cover-letter {
  border-radius: 10px 0 0 10px;
  font-size: 0.86rem;
  line-height: 1.4;
  padding: 0.55rem 0.7rem;
}

.work-cover-card .btn-primary {
  border-radius: var(--radius-control);
}

.work-app .run-row {
  padding: 0.5rem 0.15rem 0;
}

.work-app .run-note {
  font-size: 0.82rem;
  color: #94a3b8;
}

.work-panel-side .input,
.work-panel-main .input {
  border-radius: var(--radius-control);
  border-color: var(--border-strong);
  font-size: 0.92rem;
  margin-bottom: 0.65rem;
}

.work-panel-side .input:focus,
.work-panel-main .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (min-width: 981px) {
  body.work-screen-active {
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
  }

  body.work-screen-active .hero {
    display: none;
  }

  body.work-screen-active .page {
    height: 100vh;
    max-width: none;
    width: 100%;
    padding: 0.35rem 0.5rem 0.4rem;
    display: flex;
    flex-direction: column;
  }

  body.work-screen-active #step-work {
    margin: 0;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
  }

  body.work-screen-active #step-work .work-topbar {
    flex: 0 0 auto;
    margin-bottom: 0.4rem;
    width: 100%;
  }

  body.work-screen-active #step-work .dashboard-head.work-topbar {
    display: block;
  }

  body.work-screen-active .work-topbar__inner {
    width: 100%;
  }

  body.work-screen-active #step-work .work-grid {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }

  body.work-screen-active #step-work .work-panel-main,
  body.work-screen-active #step-work .work-panel-side {
    min-height: 0;
    max-height: 100%;
  }

  body.work-screen-active #step-work .work-panel-main {
    overflow: hidden;
  }

  body.work-screen-active #step-work .work-panel-side {
    overflow: auto;
  }

  body.work-screen-active #step-work .panel-block-title,
  body.work-screen-active #step-work .label {
    margin-bottom: 0.35rem;
  }

  body.work-screen-active #step-work .logs-box {
    min-height: 100px;
    flex: 1 1 0;
  }

  body.work-screen-active #step-work .work-main-cover {
    flex: 0 0 auto;
  }

  body.work-screen-active #step-work .cover-run-row {
    grid-template-rows: 64px;
  }

  body.work-screen-active #step-work .run-row {
    margin-top: 0.25rem;
    flex: 0 0 auto;
  }
}

@media (max-width: 980px) {
  .page {
    padding: 0.75rem 0.65rem 1.25rem;
  }

  .card {
    border-radius: 14px;
    padding: 1rem;
  }

  .work-grid {
    grid-template-columns: 1fr;
  }

  .work-rail {
    width: auto;
    align-self: auto;
    padding: 0.45rem 0.55rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    gap: 0.15rem;
    justify-content: center;
  }

  .work-rail-btn {
    border-radius: 12px;
    padding: 0.35rem 0.2rem;
  }

  .work-rail-btn-bottom {
    margin-top: 0;
  }

  #tab-settings {
    display: none !important;
  }

  .tab-btn-apply {
    display: flex;
  }

  .tab-row-work {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.15rem;
  }

  body.work-screen-active {
    overflow: hidden;
    height: 100dvh;
    background: var(--bg);
  }

  body.work-screen-active .page {
    max-width: none;
    width: 100%;
    padding: 0;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.work-screen-active .hero {
    display: none;
  }

  body.work-screen-active #step-work {
    margin: 0;
    flex: 1;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 0 calc(4.85rem + env(safe-area-inset-bottom, 0px));
    border-radius: 0;
    box-shadow: none;
    background: var(--bg);
    gap: 0;
  }

  body.work-screen-active #step-work .work-topbar {
    flex-shrink: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    margin-bottom: 0;
    padding: 0.65rem 0.85rem 0.6rem;
    box-shadow: 0 1px 0 var(--border);
  }

  body.work-screen-active .work-topbar__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "stats stats";
    gap: 0.55rem 0.65rem;
    align-items: start;
  }

  body.work-screen-active .work-topbar__brand {
    grid-area: brand;
  }

  body.work-screen-active .work-topbar__actions {
    grid-area: actions;
    justify-self: end;
    align-self: start;
    padding-top: 0.15rem;
    margin-left: 0;
  }

  body.work-screen-active .work-topbar__stats {
    grid-area: stats;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
    padding: 0.28rem 0.35rem;
  }

  body.work-screen-active .work-stat,
  body.work-screen-active .user-metric-card {
    min-width: 4.1rem;
    padding: 0.3rem 0.5rem;
  }

  body.work-screen-active .work-stat__value,
  body.work-screen-active .user-metric-value {
    font-size: 1rem;
  }

  body.work-screen-active .work-stat__label,
  body.work-screen-active .user-metric-label {
    font-size: 0.62rem;
  }

  body.work-screen-active .work-logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
  }

  body.work-screen-active .work-resume-btn,
  body.work-screen-active .selected-resume-chip {
    font-size: 0.92rem;
  }

  body.work-screen-active .work-action-btn span,
  body.work-screen-active .btn-switch-resume span {
    display: none;
  }

  body.work-screen-active .work-action-btn,
  body.work-screen-active .btn-switch-resume {
    width: 2.25rem;
    padding: 0;
  }

  body.work-screen-active .work-topbar__user {
    font-size: 0.75rem;
  }

  body.work-screen-active .work-layout {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
  }

  body.work-screen-active .work-col-side {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.work-screen-active.work-mobile-tab-apply .work-col-side {
    flex: 0 0 0;
    height: 0;
    min-height: 0;
    overflow: visible;
    padding: 0;
    border: none;
  }

  body.work-screen-active.work-mobile-tab-apply .work-panel-side {
    display: none !important;
  }

  body.work-screen-active.work-mobile-tab-apply .work-panel-main {
    flex: 1;
    width: 100%;
    min-height: 0;
  }

  body.work-screen-active .work-side-title {
    display: none;
  }

  body.work-screen-active .work-rail,
  body.work-screen-active .work-tabs-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    margin: 0;
    padding: 0.45rem 0.55rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.08);
    border-radius: 16px 16px 0 0;
  }

  body.work-screen-active .work-tabs-nav .tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 3.35rem;
    padding: 0.35rem 0.2rem 0.3rem;
    font-size: 0.65rem;
    line-height: 1.1;
    letter-spacing: 0.01em;
    border: none;
    background: transparent;
    border-radius: 12px;
    color: #94a3b8;
    transition: color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  }

  body.work-screen-active .work-tabs-nav .tab-btn .tab-icon {
    width: 1.4rem;
    height: 1.4rem;
    color: #94a3b8;
    transition: color 0.15s ease, transform 0.12s ease;
  }

  body.work-screen-active .work-tabs-nav .tab-btn.active {
    color: var(--accent);
    background: linear-gradient(180deg, #eef3ff 0%, #e8efff 100%);
    box-shadow: inset 0 0 0 1px rgba(43, 89, 251, 0.12);
    font-weight: 700;
  }

  body.work-screen-active .work-tabs-nav .tab-btn.active .tab-icon {
    color: var(--accent);
  }

  body.work-screen-active .work-tabs-nav .tab-btn.tab-btn-apply:not(.active) .tab-icon {
    color: #64748b;
  }

  body.work-screen-active .work-tabs-nav .tab-btn.tab-btn-apply.active {
    background: linear-gradient(180deg, #e8efff 0%, #dce8ff 100%);
    box-shadow: inset 0 0 0 1px rgba(43, 89, 251, 0.2);
  }

  body.work-screen-active .work-tabs-nav .tab-btn:active {
    transform: scale(0.97);
  }

  body.work-screen-active .work-panel-side,
  body.work-screen-active .work-panel-main {
    display: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: none;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }

  body.work-screen-active.work-mobile-tab-links .work-col-side,
  body.work-screen-active.work-mobile-tab-filters .work-col-side,
  body.work-screen-active.work-mobile-tab-funnel .work-col-side {
    flex: 1;
    height: auto;
    min-height: 0;
    overflow: hidden;
    padding: 0;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mode-funnel-view .work-col-side,
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mode-funnel-view .work-main {
    display: none !important;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mode-funnel-view .work-chats-layout {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: 100%;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .work-chats-layout {
    padding-top: 0.25rem;
    background: #f1f5f9;
  }

  /* ????????? ???????: ????? 1 ? ?????? ??????? */
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-funnel .work-crm-funnel {
    display: flex !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0.85rem 0.9rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-funnel .work-chats-col-list,
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-funnel .work-chats-col-thread {
    display: none !important;
  }

  /* ????????? ???????: ????? 2 ? ?????? ????? */
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-list .work-crm-funnel,
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-list .work-chats-col-thread {
    display: none !important;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-list .work-chats-col-list {
    display: flex !important;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    padding: 0.75rem 0.9rem;
    border: none;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-list .work-funnel-chats-head {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.45rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-list .chats-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ????????? ???????: ????? 3 ? ????????? */
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .work-crm-funnel,
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .work-chats-col-list {
    display: none !important;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .work-chats-col-thread {
    display: flex !important;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    padding: 0 0.75rem;
    border: none;
    background: transparent;
    box-shadow: none;
    gap: 0.25rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .work-chats-col-thread.work-panel {
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-mobile-thread-nav {
    display: flex;
    flex-shrink: 0;
    margin-bottom: 0.15rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-mobile-nav-btn {
    display: inline-flex;
    min-width: 0;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-head {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-context {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.4rem 0.55rem;
    padding: 0.4rem 0.1rem 0.5rem;
    border-radius: 0;
    box-shadow: none;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-title {
    font-size: 0.86rem;
    line-height: 1.25;
    font-weight: 700;
    white-space: normal;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-sub {
    margin-top: 0.08rem;
    font-size: 0.72rem;
    line-height: 1.2;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-menu-btn {
    width: 1.65rem;
    height: 1.65rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-actions {
    gap: 0.3rem;
    min-height: 1.5rem;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-vacancy-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.7rem;
    border-radius: 999px;
    gap: 0.3rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-vacancy-btn svg {
    width: 0.85rem;
    height: 0.85rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-refresh-btn {
    width: 1.65rem;
    height: 1.65rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-meta-count {
    font-size: 0.74rem;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    background: #f1f5f9;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem 0.75rem 0.35rem;
    background: transparent;
    border: none;
    border-radius: 0;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-compose {
    flex-shrink: 0;
    padding: 0.55rem 0.75rem 0.35rem;
    margin: 0;
    background: #fff;
    border-top: 1px solid #e8edf3;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-compose-row {
    gap: 0.55rem;
  }

  body.work-screen-active.work-mobile-tab-links .work-panel-side,
  body.work-screen-active.work-mobile-tab-filters .work-panel-side {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  body.work-screen-active.work-mobile-tab-chats .work-col-side,
  body.work-screen-active.work-mobile-tab-chats .work-main {
    display: none !important;
  }

  body.work-screen-active.work-mobile-tab-chats #step-work.work-mode-chats .work-chats-layout {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: 100%;
  }

  body.work-screen-active.work-mobile-tab-chats #step-work.work-mode-chats .work-chats-col-segments {
    flex: 0 0 auto;
    max-height: min(36vh, 280px);
    border-bottom: 1px solid var(--border);
  }

  body.work-screen-active.work-mobile-tab-chats #step-work.work-mode-chats .work-chats-col-list {
    flex: 0 0 38%;
    min-height: 7rem;
    border-bottom: 1px solid var(--border);
  }

  body.work-screen-active.work-mobile-tab-chats #step-work.work-mode-chats .work-chats-col-thread {
    flex: 1;
    min-height: 0;
  }

  body.work-screen-active.work-mobile-tab-apply .work-panel-main {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    overflow: hidden;
  }

  body.work-screen-active .work-panel-side {
    padding: 0.55rem 0.75rem 0.65rem;
  }

  body.work-screen-active .work-panel-main {
    padding: 0.55rem 0.75rem 0.65rem;
  }

  body.work-screen-active #panel-links,
  body.work-screen-active #panel-filters {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.work-screen-active #step-work.work-mode-chats .chats-list {
    gap: 0.5rem;
  }

  body.work-screen-active #step-work.work-mode-chats .chat-card {
    padding: 0.75rem 0.8rem;
  }

  body.work-screen-active #step-work.work-mode-chats .chat-card-head .chat-card-title {
    font-size: 0.95rem;
  }

  body.work-screen-active .logs-box {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.work-screen-active .work-main-cover {
    flex-shrink: 0;
  }

  body.work-screen-active .work-app .run-row {
    flex-shrink: 0;
    display: none;
    padding: 0.35rem 0.75rem 0;
  }

  body.work-screen-active.work-mobile-tab-apply .work-app .run-row {
    display: flex;
  }

  body.work-screen-active .work-cover-card {
    border-radius: 12px;
    border-left: none;
    border-right: none;
  }

  body.work-screen-active .work-cover-card .cover-letter {
    border-radius: var(--radius-control);
  }

  body.work-screen-active .work-app .run-row {
    padding: 0.5rem 0.85rem 0.25rem;
    background: var(--bg);
  }

  .work-grid {
    grid-template-columns: 1fr;
  }

  .btn-run {
    width: 100%;
  }

  .run-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cover-run-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .cover-letter {
    min-height: 72px;
    height: 72px;
  }

  .cover-run-row .btn-run {
    min-height: 44px;
    height: auto;
    flex-direction: row;
    gap: 0.35rem;
  }
}

@media (max-width: 900px) {
  .process-card {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .process-card-side {
    grid-column: 2;
    justify-content: flex-start;
  }
}

/* ?? CRM layout (??????? | ?????? | ?????????) ?? */
body.work-screen-active {
  background: #f3f4f6;
}

.work-app {
  gap: 0;
}

#step-work.work-mode-chats .work-crm-funnel,
#step-work.work-mode-settings .work-crm-funnel,
#step-work.work-mode-resume .work-crm-funnel {
  display: none !important;
}

#step-work.work-mode-funnel-view .work-col-side,
#step-work.work-mode-funnel-view .work-main {
  display: none !important;
}

#step-work.work-mode-funnel-view .work-chats-layout {
  display: contents;
}

#step-work.work-mode-funnel-view:not(.work-mode-funnel-chats) .work-grid {
  grid-template-columns: 4.35rem minmax(0, 1fr);
}

#step-work.work-mode-funnel-view:not(.work-mode-funnel-chats) .work-crm-funnel {
  display: flex;
  grid-column: 2;
  min-height: 0;
  flex-direction: column;
  padding: 1rem 1.1rem;
}

#step-work.work-mode-funnel-view:not(.work-mode-funnel-chats) .work-chats-col-list,
#step-work.work-mode-funnel-view:not(.work-mode-funnel-chats) .work-chats-col-thread,
#step-work.work-mode-funnel-view:not(.work-mode-funnel-chats) .work-chats-col-segments {
  display: none !important;
}

.work-crm-funnel-title {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.funnel-sync-bar {
  margin: 0 0 0.65rem;
}

.funnel-sync-btn {
  width: 100%;
  justify-content: center;
  font-size: 0.82rem;
}

.funnel-segment-sync-status {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  line-height: 1.35;
}

.funnel-segment-sync-status.hidden {
  display: none;
}

.work-crm-funnel .funnel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 0.35rem;
  padding-right: 0.15rem;
}

.work-crm-funnel-total {
  margin: 0.85rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid #eef2f7;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
}

.work-crm-funnel-total span {
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

#step-work.work-mode-settings .work-grid {
  grid-template-columns: 4.35rem minmax(0, 1fr);
}

#step-work.work-mode-settings .work-col-side {
  grid-column: 2;
  display: flex !important;
}

#step-work.work-mode-settings .work-main,
#step-work.work-mode-settings .work-chats-layout {
  display: none !important;
}

#step-work.work-mode-resume .work-grid {
  grid-template-columns: 4.35rem minmax(0, 1fr);
}

#step-work.work-mode-resume .work-col-side {
  grid-column: 2;
  display: flex !important;
}

#step-work.work-mode-resume .work-main,
#step-work.work-mode-resume .work-chats-layout {
  display: none !important;
}

#step-work.work-mode-resume .work-side-heading {
  display: none;
}

#step-work.work-mode-resume-assist .work-grid {
  grid-template-columns: 4.35rem minmax(260px, 320px) minmax(0, 1fr);
}

#step-work.work-mode-resume-assist .resume-ai-assistant {
  display: flex;
  grid-column: 2;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#step-work.work-mode-resume-assist .work-col-side {
  grid-column: 3;
}

.resume-ai-assistant {
  padding: 0.85rem 0.75rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: #fff;
  box-shadow: var(--panel-shadow);
}

.resume-ai-head {
  margin-bottom: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #eef2f7;
}

.resume-ai-head-text {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.resume-ai-spark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.resume-ai-spark svg {
  width: 1.1rem;
  height: 1.1rem;
}

.resume-ai-title {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.resume-ai-sub {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

.resume-ai-messages {
  flex: 1;
  min-height: 12rem;
  max-height: min(52vh, 520px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.15rem 0.1rem 0.5rem;
  scrollbar-width: thin;
}

.resume-ai-msg {
  max-width: 96%;
  padding: 0.58rem 0.68rem;
  border-radius: 12px;
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: normal;
  word-break: break-word;
}

.resume-ai-msg--assistant {
  align-self: flex-start;
  background: #f3f6ff;
  border: 1px solid #dbeafe;
  color: #1e293b;
}

.resume-ai-msg--user {
  align-self: flex-end;
  background: #eef3ff;
  border: 1px solid #c7d7fe;
  color: #1e3a8a;
}

.resume-ai-msg--system {
  align-self: center;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  font-size: 0.68rem;
  padding: 0.35rem 0.5rem;
}

.resume-ai-msg--typing {
  align-self: flex-start;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
}

.resume-ai-status {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: #64748b;
}

.resume-ai-compose {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.55rem;
  border-top: 1px solid #eef2f7;
}

.resume-ai-input {
  min-height: 3.2rem;
  resize: vertical;
  line-height: 1.45;
}

.resume-ai-send {
  width: 100%;
}

.resume-ai-send:disabled,
.resume-ai-input:disabled {
  opacity: 0.65;
}

@media (max-width: 980px) {
  #step-work.work-mode-resume-assist .work-grid {
    grid-template-columns: 4.35rem minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  #step-work.work-mode-resume-assist .resume-ai-assistant {
    grid-column: 2;
    grid-row: 1;
    max-height: 38vh;
  }

  #step-work.work-mode-resume-assist .work-col-side {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
  }

  .resume-ai-messages {
    max-height: 22vh;
    min-height: 8rem;
  }
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-panel-title {
  margin-bottom: 0.35rem !important;
}

.settings-group {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafbfd;
}

.settings-group-title {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.settings-hint,
.settings-user-info {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.45;
}

.settings-btn {
  width: 100%;
  justify-content: center;
}

.settings-btn-danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.settings-btn-danger:hover {
  background: #fef2f2;
}

.ai-prefs-panel .settings-group .label {
  margin-top: 0.55rem;
  margin-bottom: 0.25rem;
}

.ai-prefs-panel .settings-group .input:first-of-type {
  margin-top: 0;
}

.ai-notes-input {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.45;
}

/* ===== Resume hub tab ===== */
.resume-hub-panel {
  padding-right: 0.35rem;
}

.resume-hub {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  max-width: 920px;
  margin: 0 auto;
  padding: 0.15rem 0.35rem 0.5rem;
}

.resume-hub-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.resume-hub-title {
  margin: 0 0 0.45rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.resume-hub-subtitle {
  margin: 0;
  max-width: 34rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

.resume-hub-illustration {
  flex: 0 0 auto;
  width: 7.5rem;
  opacity: 0.92;
}

.resume-hub-illustration svg {
  display: block;
  width: 100%;
  height: auto;
}

.resume-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.resume-hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.15rem 1.1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--card);
  box-shadow: var(--panel-shadow);
}

.resume-hub-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.resume-hub-card-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.resume-hub-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.resume-hub-card-desc {
  margin: 0;
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}

.resume-hub-btn {
  width: 100%;
  justify-content: space-between;
  margin-top: 0.35rem;
  padding: 0.72rem 1rem;
  font-weight: 600;
}

.resume-hub-btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.resume-hub-privacy {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f8ff 100%);
}

.resume-hub-privacy-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--accent);
}

.resume-hub-privacy-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.resume-hub-privacy-text {
  flex: 1;
  min-width: 0;
}

.resume-hub-privacy-title {
  display: block;
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.resume-hub-privacy-desc {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.resume-hub-privacy-link {
  flex-shrink: 0;
  align-self: center;
  padding: 0.35rem 0.15rem;
  border: none;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.resume-hub-privacy-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

@media (max-width: 860px) {
  .resume-hub-grid {
    grid-template-columns: 1fr;
  }

  .resume-hub-head {
    flex-direction: column;
  }

  .resume-hub-illustration {
    width: 6rem;
    align-self: flex-end;
  }

  .resume-hub-privacy {
    flex-wrap: wrap;
  }

  .resume-hub-privacy-link {
    align-self: flex-start;
    margin-left: calc(2.35rem + 0.85rem);
  }
}

.resume-view.hidden {
  display: none !important;
}

.resume-wizard-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.resume-wizard-back {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.38rem 0.75rem;
  white-space: nowrap;
}

.resume-wizard-progress-wrap {
  flex: 1;
  min-width: 0;
  padding-top: 0.1rem;
}

.resume-wizard-step-label {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
}

.resume-wizard-progress {
  height: 0.35rem;
  border-radius: 999px;
  background: #e8eef7;
  overflow: hidden;
}

.resume-wizard-progress span {
  display: block;
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.resume-wizard-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.resume-wizard-lead {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
}

.resume-wizard-grid {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.resume-wizard-grid--2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resume-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.resume-field-hint {
  margin: 0.15rem 0 0;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #64748b;
}

.resume-wizard-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.resume-wizard-actions .btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0.62rem 1rem;
  font-size: 0.92rem;
}

.resume-wizard-actions .btn-primary {
  min-width: 8.5rem;
}

.resume-wizard-nav {
  min-width: 6.5rem;
}

@media (max-width: 720px) {
  .resume-wizard-grid--2col {
    grid-template-columns: 1fr;
  }
}

.resume-exp-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  max-height: min(calc(100vh - 17rem), 380px);
  overflow-y: auto;
  padding-right: 0.15rem;
  scrollbar-width: thin;
}

.resume-exp-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  overflow: hidden;
  flex-shrink: 0;
}

.resume-exp-card.is-filled {
  border-color: #dbeafe;
}

.resume-exp-card.is-expanded {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.08);
}

.resume-exp-card-head {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.45rem 0.45rem 0.45rem 0.55rem;
  background: #f8fafc;
  border-bottom: none;
}

.resume-exp-card.is-expanded .resume-exp-card-head {
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.resume-exp-card-toggle {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.35rem 0.25rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.resume-exp-card-toggle:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  border-radius: 8px;
}

.resume-exp-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-top: 0.05rem;
  border-radius: 8px;
  background: #eef3ff;
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.resume-exp-card-toggle-body {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
  flex: 1;
}

.resume-exp-card-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  word-break: break-word;
}

.resume-exp-card:not(.is-expanded) .resume-exp-card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resume-exp-card-period {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.3;
}

.resume-exp-card-preview-text {
  font-size: 0.72rem;
  line-height: 1.35;
  color: #475569;
  word-break: break-word;
}

.resume-exp-card-preview-text.is-empty {
  color: #94a3b8;
  font-style: italic;
}

.resume-exp-card:not(.is-expanded) .resume-exp-card-preview-text:not(.is-empty) {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resume-exp-card.is-expanded .resume-exp-card-preview-text,
.resume-exp-card.is-expanded .resume-exp-chips {
  display: none;
}

.resume-exp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.15rem;
}

.resume-exp-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.resume-exp-chip--ok {
  background: #dcfce7;
  color: #166534;
}

.resume-exp-chip--empty {
  background: #f1f5f9;
  color: #94a3b8;
}

.resume-exp-chevron {
  flex-shrink: 0;
  margin-top: 0.2rem;
  color: #64748b;
  transition: transform 0.2s ease;
}

.resume-exp-card.is-expanded .resume-exp-chevron {
  transform: rotate(180deg);
  color: #1d4ed8;
}

.resume-exp-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: 0.15rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.resume-exp-remove:hover {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

.resume-exp-card-body {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem;
}

.resume-exp-card.is-expanded .resume-exp-card-body {
  display: flex;
}

.resume-exp-row {
  display: grid;
  gap: 0.6rem;
}

.resume-exp-row--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resume-exp-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.resume-exp-textarea {
  min-height: 4.5rem;
  max-height: 12rem;
  resize: vertical;
  line-height: 1.45;
  font-size: 0.86rem;
}

.resume-exp-card .input {
  margin-top: 0;
  font-size: 0.86rem;
  padding: 0.55rem 0.65rem;
}

.resume-exp-card .label {
  font-size: 0.76rem;
  color: #475569;
  margin: 0;
}

.resume-add-exp {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0;
  margin-bottom: 0.35rem;
  padding: 0.72rem 1rem;
  font-size: 0.88rem;
  border-style: dashed;
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.resume-add-exp:hover:not(:disabled) {
  background: #eef3ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

@media (max-width: 720px) {
  .resume-exp-row--2 {
    grid-template-columns: 1fr;
  }

  .resume-exp-card-head {
    align-items: flex-start;
  }
}

.resume-loading-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 18rem;
}

.resume-loading-card {
  width: min(100%, 28rem);
  padding: 1.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: #fff;
  box-shadow: var(--panel-shadow);
  text-align: center;
}

.resume-loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.85rem;
  border: 3px solid #dbeafe;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: resume-spin 0.85s linear infinite;
}

@keyframes resume-spin {
  to { transform: rotate(360deg); }
}

.resume-loading-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.45;
}

.resume-loading-bar {
  height: 0.4rem;
  border-radius: 999px;
  background: #e8eef7;
  overflow: hidden;
}

.resume-loading-bar span {
  display: block;
  height: 100%;
  width: 12%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width 0.35s ease;
}

.resume-result-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.resume-result-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.resume-result-editor {
  min-height: 16rem;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
}

.resume-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.resume-improve-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.resume-improve-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.resume-improve-panel {
  margin-bottom: 0.85rem;
}

.resume-improve-variants {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.resume-improve-variant {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.resume-improve-variant.is-selected,
.resume-improve-variant:has(input:checked) {
  border-color: #7f9aff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.resume-improve-variant input {
  margin-right: 0.35rem;
}

.resume-improve-variant-body strong {
  display: block;
  margin-bottom: 0.35rem;
}

.resume-improve-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #64748b;
  font-size: 0.84rem;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .resume-improve-variants {
    grid-template-columns: 1fr;
  }
}

.work-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.work-icon-btn svg {
  width: 1rem;
  height: 1rem;
}

.work-icon-btn:hover:not(:disabled) {
  border-color: #93c5fd;
  color: #2563eb;
  background: #f8faff;
}

.work-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.work-chats-col-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

#step-work.work-mode-funnel-chats .work-funnel-chats-head {
  border-bottom: none;
  margin-bottom: 0.35rem;
  padding-bottom: 0;
}

#step-work.work-mode-funnel-chats #funnel-chats-status.ok {
  color: #059669;
  font-weight: 600;
  font-size: 0.82rem;
}

#step-work.work-mode-funnel-chats .work-chats-col-list .chats-list {
  padding-top: 0.15rem;
}

#step-work.work-mode-funnel-chats .chat-card.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
  background: #f8faff;
}

#step-work.work-mode-funnel-chats .chat-card-head {
  align-items: flex-start;
}

#step-work.work-mode-funnel-chats .chat-card-time {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
}

#step-work.work-mode-funnel-chats .chat-badge.accent {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.chat-mobile-nav-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  min-height: 2rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: none;
}

.chat-mobile-nav-btn svg {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.chat-mobile-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-mobile-thread-nav {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.3rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  box-shadow: none;
}

@media (max-width: 980px) {
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-list .chat-mobile-nav-btn--back {
    display: inline-flex;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-funnel .work-chats-col-title-default,
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-list .work-chats-col-title-default,
  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .work-chats-col-title-default {
    display: none;
  }

  body.work-screen-active.work-mobile-tab-funnel #step-work.work-mobile-pane-thread .chat-thread-title {
    font-size: 0.86rem;
    line-height: 1.25;
  }

  .chat-thread-sub {
    font-size: 0.78rem;
  }

  body.work-screen-active.work-mobile-tab-settings .work-col-side {
    flex: 1;
    min-height: 0;
  }

  body.work-screen-active.work-mobile-tab-settings .work-panel-side {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  body.work-screen-active.work-mobile-tab-settings #panel-settings {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  body.work-screen-active.work-mobile-tab-resume .work-col-side {
    flex: 1;
    min-height: 0;
  }

  body.work-screen-active.work-mobile-tab-resume .work-panel-side {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  body.work-screen-active.work-mobile-tab-resume #panel-resume {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  body.work-screen-active.work-mobile-tab-ai .work-col-side {
    flex: 1;
    min-height: 0;
  }

  body.work-screen-active.work-mobile-tab-ai #panel-ai {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
}

/* ===== Mockup polish: workspace exact match ===== */
body.work-screen-active {
  background: #f3f4f6 !important;
}

.work-logo {
  background: transparent url("/img/otclicks-mark.png?v=3") center / 92% no-repeat;
  box-shadow: none;
}

.work-action-btn,
.btn-switch-resume {
  border-radius: 12px;
  border-color: var(--border);
  background: #fff;
}

.work-action-btn--ghost {
  border-color: var(--border);
  background: #fff;
  color: #374151;
}

.work-action-btn--ghost:hover {
  background: #f9fafb;
  border-color: var(--border-strong);
}

.work-stat--muted .work-stat__value,
.user-metric-card.user-metric-stub .user-metric-value {
  color: #cbd5e1;
}

#step-work.work-mode-funnel-chats .work-crm-funnel,
#step-work.work-mode-funnel-chats .work-chats-col-list,
#step-work.work-mode-funnel-chats .work-chats-col-thread {
  border-radius: var(--radius-panel);
  box-shadow: var(--panel-shadow);
  border: 1px solid var(--border);
  background: #fff;
}

#step-work.work-mode-funnel-chats .funnel-sync-btn {
  height: 2.4rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  color: #334155;
  font-weight: 600;
}

#step-work.work-mode-funnel-chats .funnel-segment-sync-status:not(.hidden),
#step-work.work-mode-funnel-chats .funnel-segment-sync-status.syncing {
  color: #dc2626;
  font-weight: 600;
}

#step-work.work-mode-funnel-chats .funnel-item {
  align-items: center;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

#step-work.work-mode-funnel-chats .funnel-item-step {
  margin-top: 0;
}

#step-work.work-mode-funnel-chats .funnel-item.is-active {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: none;
}

#step-work.work-mode-funnel-chats .funnel-item-count {
  min-width: 1.85rem;
  height: 1.45rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

#step-work.work-mode-funnel-chats .funnel-item.is-active .funnel-item-count {
  background: #fff;
  border-color: #dbeafe;
  box-shadow: none;
  color: #334155;
}

#step-work.work-mode-funnel-chats .chat-card,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-questions,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-contact-q,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-links,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-contacts,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-meeting,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-no-questions,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-human,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-reject,
#step-work.work-mode-funnel-chats .chat-card.cat-v2-other {
  border-left: 1px solid var(--border);
  background: #fff;
  box-shadow: none;
  opacity: 1;
}

#step-work.work-mode-funnel-chats .chat-card.selected {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

#step-work.work-mode-funnel-chats .chat-card:hover {
  transform: none;
  border-color: #bfdbfe;
  box-shadow: none;
}

#step-work.work-mode-funnel-chats .chat-badge {
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-weight: 600;
}

.chat-messages-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-height: 2rem;
  padding: 0.32rem 0.7rem;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-messages-pill:hover:not(:disabled) {
  background: #dbeafe;
  border-color: #93c5fd;
}

.chat-messages-pill:disabled {
  opacity: 0.55;
  cursor: default;
}

.chat-messages-pill svg {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

.chat-messages-pill .chat-thread-meta-count {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
}

.chat-messages-pill .chat-thread-meta-count.err {
  color: #b91c1c;
}

#step-work.work-mode-funnel-chats .chat-thread-head,
#step-work.work-mode-chats .chat-thread-head {
  margin-bottom: 0;
}

#step-work.work-mode-funnel-chats .chat-thread-context,
#step-work.work-mode-chats .chat-thread-context {
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  padding: 0.45rem 0.1rem 0.55rem;
  margin: 0;
  border: none;
  border-bottom: 1px solid #eef2f7;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#step-work.work-mode-funnel-chats .chat-msg-row.is-out .chat-msg-avatar {
  display: none;
}

#step-work.work-mode-funnel-chats .chat-msg-bubble.is-out .chat-msg-author {
  display: none;
}

#step-work.work-mode-funnel-chats .chat-msg-avatar--in {
  background: #8b5cf6;
  color: #fff;
  width: 2.35rem;
  height: 2.35rem;
  font-size: 0.85rem;
}

#step-work.work-mode-funnel-chats .chat-msg-bubble.is-in {
  border-left: none;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#step-work.work-mode-funnel-chats .chat-msg-bubble.is-out {
  background: #eff6ff;
  border-radius: 14px;
  border-bottom-right-radius: 6px;
}

#step-work.work-mode-funnel-chats .chat-msg-date {
  background: #e5e7eb;
  color: #6b7280;
}

.chat-compose-toolbar {
  display: none;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.chat-compose-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 2rem;
  padding: 0.35rem 0.45rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.chat-compose-tool:hover:not(:disabled) {
  background: #f1f5f9;
  color: #475569;
}

.chat-compose-tool:disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-compose-tool svg {
  width: 1.05rem;
  height: 1.05rem;
}

.chat-compose-tool-caret {
  width: 0.75rem !important;
  height: 0.75rem !important;
}

.chat-compose-tool--ai {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  min-width: 3.1rem;
}

.chat-compose-tool--ai:hover:not(:disabled) {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}

.chat-compose-tool--ai[aria-busy="true"] {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
  cursor: wait;
}

.chat-compose-send-wrap {
 display: inline-flex;
 align-items: center;
 gap: 0.55rem;
 margin-left: auto;
}

.chat-compose:not(.chat-compose--funnel-ai) .chat-compose-toolbar {
 display: inline-flex;
}

.chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel__foot {
 display: flex !important;
 align-items: center;
 justify-content: space-between;
 gap: 0.65rem;
 margin-top: 0.55rem;
 width: 100%;
}

#step-work.work-mode-funnel-chats .chat-compose:not(.chat-compose--funnel-ai),
#step-work.work-mode-chats .chat-compose:not(.chat-compose--funnel-ai) {
  padding: 0.65rem 0.75rem 0.7rem;
  border-top: 1px solid #e8edf3;
  background: #fff;
  flex-shrink: 0;
}

#step-work.work-mode-funnel-chats .chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel,
#step-work.work-mode-chats .chat-compose:not(.chat-compose--funnel-ai) .ai-reply-panel {
  border-color: #e8edf3;
}

.chat-compose:not(.chat-compose--funnel-ai) .chat-compose-send-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.chat-compose:not(.chat-compose--funnel-ai) .chat-compose-toolbar {
  display: inline-flex;
  flex-shrink: 0;
}

.chat-compose--funnel-ai .chat-compose-toolbar {
 display: none;
}

.chat-compose--funnel-ai .chat-compose-send-wrap .ai-reply-panel__hint {
 display: none;
}

.work-footer-note,
.work-footer-note .run-note {
 display: none !important;
}

@media (max-width: 980px) {
  .chats-load-banner {
    bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
    width: min(22rem, calc(100vw - 1rem));
    padding: 0.35rem 0.55rem 0.4rem;
  }
}

/* ===========================================
   RESPONSIVE POLISH ? mid desktop + small phones
   =========================================== */

@media (min-width: 981px) and (max-width: 1279px) {
  .work-grid {
    grid-template-columns: 4.35rem minmax(200px, 240px) minmax(0, 1fr);
  }

  #step-work.work-mode-chats .work-grid {
    grid-template-columns: 4.35rem minmax(150px, 190px) minmax(170px, 210px) minmax(0, 1fr);
  }

  #step-work.work-mode-funnel-chats .work-grid {
    grid-template-columns: 4.35rem minmax(170px, 210px) minmax(190px, 230px) minmax(0, 1fr);
    gap: 0.5rem;
  }

  #step-work.work-mode-funnel-chats .work-chats-col-list,
  #step-work.work-mode-funnel-chats .work-chats-col-thread {
    padding: 0.75rem 0.85rem;
  }

  #step-work.work-mode-funnel-chats .chat-thread-context,
  #step-work.work-mode-chats .chat-thread-context {
    flex-wrap: wrap;
    row-gap: 0.45rem;
  }

  .cover-run-row {
    grid-template-columns: minmax(0, 1fr) minmax(6rem, 6.75rem);
    grid-template-rows: minmax(3.5rem, 3.85rem);
  }
}

@media (min-width: 1200px) {
  .logs-table {
    min-width: 56rem;
  }
}

@media (max-width: 980px) {
  .chats-load-banner {
    bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
    width: min(22rem, calc(100vw - 1rem));
    padding: 0.35rem 0.55rem 0.4rem;
  }

  body.work-screen-active .work-tabs-nav .tab-btn {
    font-size: clamp(0.58rem, 2.4vw, 0.65rem);
    min-height: 3.15rem;
    padding: 0.3rem 0.1rem 0.25rem;
  }
}

@media (max-width: 379px) {
  .otp-track {
    height: 4.5rem;
    gap: 0.35rem;
    padding: 0 0.65rem;
  }

  .otp-cell {
    max-width: 2.35rem;
    height: 2.55rem;
    font-size: 1.45rem;
  }

  .otp-shell.is-otp-6 .otp-track {
    height: 4.15rem;
    gap: 0.25rem;
    padding: 0 0.45rem;
  }

  .otp-shell.is-otp-6 .otp-cell {
    max-width: 2rem;
    height: 2.25rem;
    font-size: 1.15rem;
    border-radius: 0.55rem;
  }

  .btn {
    padding: 0.8rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 1100px) {
  .cover-run-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .cover-run-row .btn-run {
    min-height: 2.75rem;
    height: auto;
  }
}

/* ===== Resume dialog (chat-first, fullscreen work-area) ===== */
body.work-screen-active #step-work.work-mode-resume-dialog .work-col-side,
body.work-screen-active #step-work.work-mode-resume-dialog .work-panel-side {
  height: 100%;
  min-height: 0;
}

body.work-screen-active #step-work.work-mode-resume-dialog .work-panel-side {
  padding: 0 !important;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #fff;
  overflow: hidden !important;
  max-height: none;
}

body.work-screen-active #step-work.work-mode-resume-dialog #panel-resume {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0;
}

body.work-screen-active #step-work.work-mode-resume-dialog #panel-resume .resume-dialog-view,
body.work-screen-active #step-work.work-mode-resume-dialog #panel-resume .resume-dialog-review {
  flex: 1;
  min-height: 0;
  height: 100%;
}

/* Collapse grid gap so dialog sits flush in the content column */
body.work-screen-active #step-work.work-mode-resume-dialog.work-mode-resume .work-grid {
  gap: 0.5rem;
}

.resume-dialog-view,
.resume-dialog-review {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  height: 100%;
  padding: 0.65rem 0.85rem 0.75rem;
  box-sizing: border-box;
}

.resume-dialog-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.resume-dialog-head-text {
  flex: 1;
  min-width: 0;
}

.resume-dialog-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.resume-dialog-phase {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.resume-dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0.75rem;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
}

.resume-dialog-chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 40%);
  overflow: hidden;
}

.resume-dialog-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  scroll-behavior: smooth;
}

.resume-dialog-msg {
  max-width: min(92%, 56rem);
  padding: 0.7rem 0.95rem;
  border-radius: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #1e293b;
  white-space: normal;
}

.resume-dialog-msg--assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.resume-dialog-msg--user {
  align-self: flex-end;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
}

.resume-dialog-msg--typing {
  align-self: flex-start;
  color: #64748b;
  font-size: 0.84rem;
  font-style: italic;
  background: transparent;
  border: none;
  padding: 0.25rem 0.4rem;
}

.resume-dialog-status {
  margin: 0;
  padding: 0.35rem 1rem 0;
  font-size: 0.8rem;
  color: #475569;
}

.resume-dialog-status.is-error {
  color: #b91c1c;
}

.resume-dialog-compose {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.resume-dialog-input {
  resize: vertical;
  min-height: 4.2rem;
  max-height: 10rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.resume-dialog-compose-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
}

.resume-dialog-mic.is-recording {
  color: #b91c1c;
  box-shadow: inset 0 0 0 1px #fecaca;
}

.resume-dialog-side {
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 0.9rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 280px;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

.resume-dialog-side-label {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  font-weight: 600;
}

.resume-dialog-side-value {
  margin: 0;
  font-size: 0.9rem;
  color: #0f172a;
  word-break: break-word;
}

.resume-dialog-progress {
  height: 0.45rem;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.resume-dialog-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.25s ease;
}

.resume-dialog-progress-text {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #475569;
}

.resume-dialog-gaps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.resume-dialog-gap {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.4rem;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.resume-dialog-gap--ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.resume-dialog-side-btn {
  margin-top: auto;
}

.resume-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.resume-review-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.resume-review-card h4 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.resume-review-card--wide {
  grid-column: 1 / -1;
}

.resume-review-exp-item {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.45rem;
}

.resume-review-exp-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}

.resume-review-exp-item summary span {
  font-weight: 400;
  color: #64748b;
  font-size: 0.8rem;
}

.resume-review-exp-item p {
  margin: 0.45rem 0 0;
  font-size: 0.86rem;
  color: #334155;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .resume-dialog-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .resume-dialog-side {
    max-width: none;
    height: auto;
    max-height: 38vh;
    order: 2;
  }

  .resume-dialog-chat {
    min-height: 0;
    order: 1;
  }

  .resume-review-grid {
    grid-template-columns: 1fr;
  }

  #step-work.work-mode-resume-dialog .resume-dialog-view,
  #step-work.work-mode-resume-dialog .resume-dialog-review {
    padding: 0.5rem 0.55rem 0.6rem;
  }
}

/* Review fills remaining height and scrolls inside */
#step-work.work-mode-resume-dialog .resume-dialog-review {
  overflow: hidden;
}

#step-work.work-mode-resume-dialog .resume-review-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
