/* =====================================================================
   AI-CRM — app.css
   Tokens → base → layout → components → modals → responsive
   ===================================================================== */

:root {
  --bg:        #f4f5f9;
  --surface:   #ffffff;
  --surface-2: #f8f9fc;
  --ink:       #1b1f2e;
  --ink-2:     #4b5166;
  --muted:     #7b8194;
  --line:      #e3e6ee;
  --line-2:    #eef0f5;
  --accent:    #3457d5;
  --accent-2:  #2846b8;
  --accent-soft: #eaf0ff;
  --danger:    #d9364c;
  --danger-soft: #fdecef;
  --ok:        #13996b;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-1: 0 1px 2px rgba(27, 31, 46, .05), 0 1px 6px rgba(27, 31, 46, .04);
  --shadow-2: 0 4px 16px rgba(27, 31, 46, .08), 0 1px 3px rgba(27, 31, 46, .05);
  --shadow-3: 0 24px 64px rgba(27, 31, 46, .18), 0 4px 16px rgba(27, 31, 46, .08);

  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9333rem; /* 14px */
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Brand ---------- */
.brand-mark {
  display: inline-block; width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent) 0%, #7a5cf5 100%);
  position: relative;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 7px; border-radius: 3px; background: #fff; opacity: .9;
}
.brand-name { font-weight: 800; letter-spacing: -0.02em; font-size: 1.05rem; }

/* ---------- Form controls ---------- */
.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b8194' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.field { display: block; margin-bottom: 14px; }
.field__label { display: block; margin-bottom: 5px; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.field__hint { display: block; margin-top: 4px; font-size: .78rem; color: var(--muted); }
.field--inline { display: flex; align-items: center; gap: 8px; }
.form-error { margin: 0 0 12px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: .85rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-2); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: #cdd2de; color: var(--ink); }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn--danger:hover { background: #f9d6dc; }
.btn--sm { padding: 5px 10px; font-size: .8rem; border-radius: var(--r-sm); }
.btn--block { width: 100%; }
.btn--link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 600; }

/* ---------- Login ---------- */
.page-login { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login {
  width: 100%; max-width: 380px;
  padding: 36px 32px 32px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
}
.login__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login__title { font-size: 1.45rem; margin-bottom: 6px; }
.login__hint { margin: 0 0 24px; color: var(--muted); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; }
.topbar__search { position: relative; flex: 1; max-width: 560px; }
.topbar__search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input--search { padding-left: 36px; background: var(--surface-2); border-color: transparent; }
.input--search:focus { background: var(--surface); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  margin-left: 8px; padding: 4px 6px 4px 4px;
  border-radius: 999px; border: 1px solid var(--line);
}
.user-chip__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: .8rem; font-weight: 700;
}
.user-chip__name { font-weight: 600; font-size: .85rem; }
.user-chip__logout { border: none; background: none; color: var(--muted); font-size: .78rem; padding: 2px 6px; }
.user-chip__logout:hover { color: var(--danger); }

/* ---------- Filters ---------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 28px;
  padding: 14px 24px 4px;
}
.filters__group { display: flex; align-items: center; gap: 10px; }
.filters__label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.filters__reset { margin-left: auto; border: none; background: none; color: var(--accent); font-weight: 600; font-size: .82rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: .8rem; font-weight: 500;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: #c9cfdd; }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--muted)); }
.chip.is-on .chip__dot { background: #fff; }

/* ---------- Content / table ---------- */
.content { padding: 14px 24px 40px; }
.table-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line-2);
}
.table-card__head, .table-card__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
}
.table-card__head { border-bottom: 1px solid var(--line-2); }
.table-card__foot { border-top: 1px solid var(--line-2); }
.table-card__count { font-weight: 700; }
.table-card__hint { font-size: .78rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }

.grid { width: 100%; border-collapse: collapse; min-width: 1100px; }
.grid th {
  position: sticky; top: 0;
  padding: 10px 12px;
  text-align: left;
  font-size: .76rem; font-weight: 700; color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
}
.grid th[data-sort] { cursor: pointer; }
.grid th[data-sort]:hover { color: var(--ink); }
.grid th.is-sorted::after { content: ' ↑'; color: var(--accent); }
.grid th.is-sorted.is-desc::after { content: ' ↓'; }
.th--center { text-align: center !important; }
.grid td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.grid tbody tr { cursor: pointer; transition: background .1s; }
.grid tbody tr:hover { background: #f9faff; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid .td--center { text-align: center; }

.cell-name { font-weight: 700; }
.cell-name__link { border-bottom: 1px dashed transparent; }
.grid tbody tr:hover .cell-name__link { color: var(--accent); border-bottom-color: var(--accent); }
.cell-name small { display: block; font-weight: 500; color: var(--muted); font-size: .76rem; }
.cell-muted { color: var(--muted); }

/* inline edit */
.editable {
  display: block; min-height: 22px; min-width: 60px;
  padding: 2px 6px; margin: -2px -6px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
}
.editable:hover { background: var(--accent-soft); }
.editable.is-empty::before { content: attr(data-placeholder); color: #b7bccb; }
.editable--select {
  appearance: none; border: 1px solid transparent; background: transparent;
  padding: 3px 24px 3px 8px; border-radius: 999px; font-weight: 600; font-size: .8rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.editable--select:hover { border-color: var(--line); }
.inline-input {
  width: 100%; padding: 3px 6px; margin: -3px -6px;
  border: 1px solid var(--accent); border-radius: var(--r-sm);
  box-shadow: 0 0 0 3px var(--accent-soft); background: #fff;
}
.checkbox { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* status colours (both for select pills and chips) */
.st-cold    { background: #eef1f6; color: #4b5166; --dot: #8b93a7; }
.st-warm    { background: #fff4e0; color: #9a5b00; --dot: #f2a233; }
.st-hot     { background: #ffe8e8; color: #b42323; --dot: #e5484d; }
.st-partner { background: #efe9ff; color: #5a35c9; --dot: #7c5cf0; }
.st-client  { background: #e3f7ee; color: #0f7a53; --dot: #17b07a; }

.col-plain  { background: #f2f3f7; color: var(--ink-2); }
.col-ready  { background: #e3f7ee; color: #0f7a53; }
.col-part   { background: #fff4e0; color: #9a5b00; }
.col-none   { background: #ffe8e8; color: #b42323; }
.col-work   { background: var(--accent-soft); color: var(--accent-2); }

/* tags */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  background: color-mix(in srgb, var(--c, var(--accent)) 12%, white);
  color: color-mix(in srgb, var(--c, var(--accent)) 80%, black);
}
.tag--add {
  background: transparent; border: 1px dashed var(--line);
  color: var(--muted); padding: 1px 7px;
}
.tag--add:hover { border-color: var(--accent); color: var(--accent); }
.tag__remove { border: none; background: none; padding: 0 0 0 2px; font-size: .9rem; line-height: 1; opacity: .6; }
.tag__remove:hover { opacity: 1; }

/* social chips */
.socials { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.social {
  display: inline-flex; align-items: stretch;
  border-radius: 7px; overflow: hidden;
  font-size: .76rem; font-weight: 700;
  border: 1px solid transparent;
  transition: box-shadow .12s;
}
.social:hover { box-shadow: var(--shadow-1); }
.social__label { padding: 3px 8px; }
.social__open { display: grid; place-items: center; padding: 0 7px; border-left: 1px solid rgba(255,255,255,.55); font-weight: 800; }
.social__open:hover { background: rgba(255,255,255,.35); }
.social--linkedin  { background: #e3eefb; color: #0a5ea8; }
.social--instagram { background: #fde7f1; color: #b8256d; }
.social--telegram  { background: #e1f2fc; color: #0e7fb8; }
.social--facebook  { background: #e6ebfa; color: #1d49b0; }

.social-add {
  width: 24px; height: 24px; border-radius: 7px;
  border: 1px dashed var(--line); background: transparent;
  color: var(--muted); font-weight: 700; display: grid; place-items: center;
}
.social-add:hover { border-color: var(--accent); color: var(--accent); }
.social-add:disabled { opacity: .35; cursor: default; }

/* dropdown menu */
.menu {
  position: absolute; z-index: 60;
  min-width: 160px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
.menu__item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px;
  border: none; background: none; border-radius: var(--r-sm);
  text-align: left; font-weight: 500;
}
.menu__item:hover { background: var(--surface-2); }
.menu__item:disabled { opacity: .4; cursor: default; }
.menu__dot { width: 8px; height: 8px; border-radius: 50%; }

/* tooltip */
.tooltip {
  position: fixed; z-index: 70;
  width: 300px; max-width: calc(100vw - 24px);
  padding: 12px 14px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  font-size: .8rem; line-height: 1.45;
  pointer-events: none;
  animation: tip-in .12s ease-out;
}
@keyframes tip-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.tooltip__title { font-weight: 800; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.tooltip__title small { font-weight: 500; opacity: .6; }
.tooltip__row { display: grid; grid-template-columns: 96px 1fr; gap: 6px; padding: 3px 0; border-top: 1px solid rgba(255,255,255,.08); }
.tooltip__row b { font-weight: 600; opacity: .6; }
.tooltip__empty { opacity: .6; }
.tooltip__url { color: #a9c1ff; word-break: break-all; }

/* pager */
.pager { display: flex; align-items: center; gap: 6px; }
.pager__btn { padding: 5px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; font-size: .8rem; }
.pager__btn:disabled { opacity: .4; cursor: default; }
.pager__info { font-size: .8rem; color: var(--muted); margin: 0 6px; }

/* empty state */
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; }

/* ---------- Modals ---------- */
.modal-root { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(27, 31, 46, .42);
  backdrop-filter: blur(2px);
  pointer-events: auto;
  animation: fade-in .15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  pointer-events: auto;
  animation: modal-in .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal--wide { width: min(1120px, calc(100vw - 32px)); height: min(820px, calc(100vh - 48px)); }
.modal__head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line-2);
}
.modal__title { font-size: 1.1rem; flex: 1; }
.modal__close {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--surface-2); color: var(--muted);
  font-size: 1.1rem; line-height: 1;
}
.modal__close:hover { background: var(--line); color: var(--ink); }
.modal__body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 22px 18px;
  border-top: 1px solid var(--line-2);
}
.modal__foot .btn--danger { margin-right: auto; }

/* ---------- CRM card ---------- */
.card { display: grid; grid-template-columns: 1.1fr 1fr; height: 100%; min-height: 0; }
.card__left { padding: 20px 22px; overflow-y: auto; border-right: 1px solid var(--line-2); }
.card__right { display: flex; flex-direction: column; background: var(--surface-2); min-height: 0; }

.card__header { margin-bottom: 18px; }
.card__name { font-size: 1.35rem; line-height: 1.2; }
.card__sub { color: var(--muted); margin-top: 2px; }
.card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.section { margin-top: 22px; }
.section__title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem; font-weight: 700; color: var(--muted);
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-2);
}
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: start; }
.kv__k { font-size: .8rem; font-weight: 600; color: var(--ink-2); padding-top: 4px; }
.kv__v { min-width: 0; }
.kv__v .editable { margin: 0; padding: 4px 6px; }
.kv__v .select, .kv__v .textarea, .kv__v .input { padding: 5px 9px; }
.kv__v .textarea { min-height: 64px; }

.social-block {
  padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: #fff;
}
.social-block__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.social-block__head .social { margin-right: auto; }
.social-block__kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: .83rem; }
.social-block__kv b { font-weight: 600; color: var(--muted); }
.social-block__url { font-size: .8rem; color: var(--accent); word-break: break-all; }

.tabs { display: flex; gap: 4px; padding: 14px 20px 0; border-bottom: 1px solid var(--line-2); }
.tab {
  padding: 8px 12px; border: none; background: none;
  font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.is-on { color: var(--accent); border-bottom-color: var(--accent); }
.tab__count { margin-left: 5px; font-size: .74rem; padding: 0 6px; border-radius: 999px; background: var(--line); color: var(--ink-2); }
.tab.is-on .tab__count { background: var(--accent-soft); color: var(--accent); }
.panel { flex: 1; overflow-y: auto; padding: 16px 20px; min-height: 0; }

.comment-form { padding: 12px 20px 16px; border-top: 1px solid var(--line-2); background: #fff; }
.comment-form .textarea { min-height: 64px; margin-bottom: 8px; }
.comment-form__actions { display: flex; justify-content: space-between; align-items: center; }
.comment-form__hint { font-size: .76rem; color: var(--muted); }

.feed { display: flex; flex-direction: column; gap: 10px; }
.note {
  padding: 10px 12px; background: #fff;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
}
.note__meta { display: flex; justify-content: space-between; gap: 8px; font-size: .76rem; color: var(--muted); margin-bottom: 4px; }
.note__meta b { color: var(--ink-2); font-weight: 700; }
.note__body { white-space: pre-wrap; word-break: break-word; }

.log { display: flex; flex-direction: column; }
.log__item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 6px 0; }
.log__dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--line); justify-self: center; }
.log__item--create .log__dot { background: var(--ok); }
.log__item--social .log__dot { background: var(--accent); }
.log__item--comment .log__dot { background: #f2a233; }
.log__text { font-size: .85rem; }
.log__text code { font-family: inherit; background: var(--line-2); padding: 0 4px; border-radius: 3px; }
.log__time { font-size: .74rem; color: var(--muted); }

/* users table (admin) */
.simple-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.simple-table th, .simple-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line-2); }
.simple-table th { font-size: .74rem; color: var(--muted); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--line-2); color: var(--ink-2); }
.badge--admin { background: var(--accent-soft); color: var(--accent); }
.badge--off { background: var(--danger-soft); color: var(--danger); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 14px; border-radius: var(--r-md);
  background: var(--ink); color: #fff; font-weight: 600; font-size: .85rem;
  box-shadow: var(--shadow-2);
  animation: toast-in .18s ease-out;
}
.toast--error { background: var(--danger); }
.toast--ok { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topbar__search { order: 3; flex-basis: 100%; max-width: none; }
  .topbar__actions { margin-left: auto; }
  .user-chip__name { display: none; }
  .filters, .content { padding-left: 14px; padding-right: 14px; }
  .card { grid-template-columns: 1fr; }
  .card__left { border-right: none; border-bottom: 1px solid var(--line-2); max-height: 50%; }
  .modal--wide { height: calc(100vh - 24px); }
  .table-card__hint { display: none; }
}

/* =====================================================================
   v2 additions
   ===================================================================== */

/* language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang-switch a { padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; color: var(--muted); }
.lang-switch a.is-on { background: var(--ink); color: #fff; }
.login__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.login__top .login__brand { margin-bottom: 0; }

/* ---------- filter dropdowns ---------- */
.filters { padding: 12px 24px 0; }
.filters__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dd { position: relative; }
.dd__btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: .83rem; color: var(--ink-2);
}
.dd__btn:hover { border-color: #c9cfdd; color: var(--ink); }
.dd__btn.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dd__btn .dd__count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; text-align: center; }
.dd__btn::after { content: ''; width: 6px; height: 6px; margin-left: 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .6; }
.dd__panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 65;
  min-width: 240px; max-width: 320px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  padding: 8px;
  animation: tip-in .12s ease-out;
}
.dd__search { margin-bottom: 6px; }
.dd__search .input { padding: 6px 10px; font-size: .83rem; }
.dd__list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.dd__opt {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer;
  font-size: .85rem;
}
.dd__opt:hover { background: var(--surface-2); }
.dd__opt input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.dd__opt .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dd__foot { display: flex; justify-content: space-between; padding: 6px 4px 0; border-top: 1px solid var(--line-2); margin-top: 6px; }
.dd__empty { padding: 10px; color: var(--muted); font-size: .83rem; }
.dd--sort .dd__opt.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.filters__reset { margin-left: auto; }
.filters__sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

/* ---------- taxonomy chips in table ---------- */
.tax-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 110px; }
.tag--pill { border-radius: 999px; }

/* ---------- socials: mutual icon ---------- */
.social__mutual { display: inline-flex; align-items: center; padding-left: 7px; margin-right: -3px; }
.social__mutual svg { width: 11px; height: 11px; }

/* ---------- comment column ---------- */
.th--comment { min-width: 260px; }
.ccell { min-width: 260px; max-width: 340px; }
.ccell__last { font-size: .83rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ccell__meta { font-size: .72rem; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.ccell__more { border: none; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: .72rem; }
.ccell__more:hover { text-decoration: underline; }
.ccell__empty { color: #b7bccb; font-size: .8rem; }
.ccell__input {
  width: 100%; margin-top: 5px; padding: 4px 8px;
  border: 1px solid transparent; border-radius: var(--r-sm); background: var(--surface-2);
  font-size: .8rem;
}
.ccell__input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.ccell__list { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; padding-right: 2px; }
.ccell__item { padding: 5px 8px; background: var(--surface-2); border-radius: var(--r-sm); font-size: .8rem; }
.ccell__item small { display: block; color: var(--muted); font-size: .7rem; }

/* ---------- quick add rows ---------- */
.quick td { background: #fbfbfe; padding: 6px 12px; border-bottom: 1px solid var(--line-2); }
#quickBottom td { border-bottom: none; border-top: 1px solid var(--line-2); }
.quick__row { display: flex; gap: 6px; align-items: center; }
.quick__row .input { padding: 6px 10px; font-size: .83rem; background: #fff; }
.quick__name { flex: 0 0 240px; }
.quick__company { flex: 0 0 200px; }
.quick__position { flex: 0 0 180px; }
.quick__hint { font-size: .74rem; color: var(--muted); margin-left: 6px; }

/* ---------- pager / per page ---------- */
.per-page { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); }
.per-page .select { width: auto; padding: 4px 26px 4px 8px; font-size: .8rem; }

/* ---------- taxonomy manager ---------- */
.taxm { display: grid; grid-template-columns: 160px 1fr; gap: 18px; min-height: 380px; }
.taxm__nav { display: flex; flex-direction: column; gap: 4px; }
.taxm__nav button { text-align: left; padding: 8px 12px; border: none; background: none; border-radius: var(--r-md); font-weight: 600; color: var(--ink-2); }
.taxm__nav button.is-on { background: var(--accent-soft); color: var(--accent); }
.taxm__nav button span { float: right; color: var(--muted); font-weight: 500; font-size: .78rem; }
.taxm__hint { font-size: .78rem; color: var(--muted); margin: 0 0 10px; }
.taxm__list { display: flex; flex-direction: column; gap: 4px; }
.taxm__item {
  display: grid; grid-template-columns: 18px 22px 1fr auto auto; align-items: center; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: #fff;
}
.taxm__item.is-dragging { opacity: .4; }
.taxm__item.is-over { border-color: var(--accent); box-shadow: 0 -2px 0 var(--accent); }
.taxm__grip { color: #c3c8d6; cursor: grab; font-size: 1rem; line-height: 1; user-select: none; }
.taxm__swatch { width: 22px; height: 22px; border-radius: 7px; border: none; cursor: pointer; padding: 0; background: none; position: relative; }
.taxm__swatch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.taxm__swatch::before { content: ''; position: absolute; inset: 0; border-radius: 7px; background: var(--c); }
.taxm__name { border: 1px solid transparent; border-radius: var(--r-sm); padding: 3px 6px; font-weight: 600; }
.taxm__name:hover { border-color: var(--line); }
.taxm__name:focus { border-color: var(--accent); outline: none; background: #fff; }
.taxm__used { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.taxm__del { border: none; background: none; color: var(--muted); padding: 2px 6px; border-radius: var(--r-sm); }
.taxm__del:hover { background: var(--danger-soft); color: var(--danger); }
.taxm__add { display: flex; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.taxm__add .input { flex: 1; }

/* ---------- colour field ---------- */
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field .swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.color-field .sw { width: 22px; height: 22px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.color-field .sw.is-on { border-color: var(--ink); }
.color-field .custom { position: relative; width: 22px; height: 22px; border-radius: 7px; border: 1px dashed var(--line); overflow: hidden; }
.color-field .custom input { position: absolute; inset: -4px; width: 40px; height: 40px; opacity: 0; cursor: pointer; }
.color-field .custom::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; color: var(--muted); pointer-events: none; }
.color-field .custom.is-on { border-style: solid; border-color: var(--ink); }
.color-field .custom.is-on::after { content: ''; }
.color-field .preview { margin-left: auto; }

/* menu above modals */
.menu { z-index: 95; }
.tooltip { z-index: 96; }

/* card: taxonomy rows */
.kv__v .tax-cell { min-height: 26px; }
.social-block__head .badge { margin-left: 4px; }

@media (max-width: 960px) {
  .quick__name, .quick__company, .quick__position { flex: 1 1 120px; }
  .taxm { grid-template-columns: 1fr; }
  .taxm__nav { flex-direction: row; flex-wrap: wrap; }
  .lang-switch { display: none; }
}

/* =====================================================================
   v3 additions
   ===================================================================== */

/* burger / mobile header */
.burger { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; padding: 9px; flex-direction: column; justify-content: space-between; margin-left: auto; }
.burger span { display: block; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .15s, opacity .15s; }
.burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* collection column: compact toggle */
.th--col { width: 90px; }
.col-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.col-toggle::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }
.col-toggle:hover { border-color: currentColor; }

/* quick-add row */
.quick-bar td { padding: 6px 12px; background: #fbfbfe; }
.quick-bar__btn { border: 1px dashed var(--line); background: #fff; color: var(--accent); font-weight: 600; font-size: .82rem; padding: 6px 12px; border-radius: var(--r-md); width: 100%; text-align: left; }
.quick-bar__btn:hover { border-color: var(--accent); background: var(--accent-soft); }
tr.quick-row td { background: #f6f8ff; vertical-align: top; padding: 8px 12px; border-top: 2px solid var(--accent-soft); border-bottom: 2px solid var(--accent-soft); }
.quick-row .input, .quick-row .textarea { padding: 5px 8px; font-size: .83rem; background: #fff; }
.quick-row .textarea { min-height: 54px; }
.quick-row__name { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.quick-row__actions { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.quick-row__keys { font-size: .72rem; color: var(--muted); }
.quick-row .tax-cell { min-height: 30px; align-items: center; }
.quick-row__na { color: #b7bccb; font-size: .78rem; }

/* users modal */
.modal--users { width: min(880px, calc(100vw - 32px)); }
.simple-table .select--inline { width: auto; padding: 3px 26px 3px 8px; font-size: .8rem; }
.simple-table td { vertical-align: middle; }

/* social sync */
.social-block__sync { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .74rem; color: var(--muted); }
.social-block__sync .badge--due { background: #fff4e0; color: #9a5b00; }
.social--due .social__label { text-decoration: underline dotted; text-underline-offset: 3px; }
.sync-field { display: flex; gap: 8px; align-items: center; }
.sync-field .input { flex: 1; }

@media (max-width: 960px) {
  .burger { display: flex; }
  .topbar { flex-wrap: wrap; }
  .topbar__actions { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line-2); margin-top: 4px; }
  .topbar__actions.is-open { display: flex; }
  .topbar__actions .btn { justify-content: flex-start; }
  .lang-switch { display: inline-flex; align-self: flex-start; }
  .user-chip { margin-left: 0; }
  .user-chip__name { display: inline; }
  .topbar__search { order: 3; }
}
