/* EXELENT · панель продавца. Строгий минимализм: Geist, нейтральные цвета, тонкие границы, синий — только в графиках. */
:root {
  --background: #ffffff; --canvas: #fafafa; --card: #ffffff; --card-2: #f4f4f5;
  --border: rgba(0, 0, 0, .08); --border-strong: rgba(0, 0, 0, .14);
  --foreground: #0a0a0b; --text-2: rgba(10, 10, 11, .72); --muted-foreground: #71717a; --faint: #a1a1aa;
  --hover: rgba(10, 10, 11, .04); --selected: rgba(10, 10, 11, .06);
  --chart: #2563eb; --brand: #0a0a0b; --brand-fg: #ffffff;
  --positive: #059669; --positive-wash: rgba(5, 150, 105, .09);
  --negative: #dc2626; --negative-wash: rgba(220, 38, 38, .08);
  --warning: #d97706; --warning-wash: rgba(217, 119, 6, .1);
  --overlay: rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px -12px rgba(0, 0, 0, .08);
  --shadow-float: 0 1px 2px rgba(0, 0, 0, .08), 0 24px 48px -12px rgba(0, 0, 0, .18);
  --ring: rgba(10, 10, 11, .35);
  --font: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.23, 1, .32, 1);
  color-scheme: light;
}
.dark {
  --background: #0a0a0b; --canvas: #0a0a0b; --card: #0f0f11; --card-2: #161618;
  --border: rgba(255, 255, 255, .07); --border-strong: rgba(255, 255, 255, .12);
  --foreground: #fafafa; --text-2: rgba(250, 250, 250, .72); --muted-foreground: #8b8b94; --faint: #5f5f68;
  --hover: rgba(250, 250, 250, .04); --selected: rgba(250, 250, 250, .065);
  --chart: #3b6dff; --brand: #fafafa; --brand-fg: #0a0a0b;
  --positive: #34d399; --positive-wash: rgba(52, 211, 153, .1);
  --negative: #f87171; --negative-wash: rgba(248, 113, 113, .1);
  --warning: #fbbf24; --warning-wash: rgba(251, 191, 36, .1);
  --overlay: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-float: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 48px -12px rgba(0, 0, 0, .7);
  --ring: rgba(250, 250, 250, .4);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #app { height: 100%; margin: 0; }
body { background: var(--background); color: var(--foreground); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-foreground); } .faint { color: var(--faint); }
.pos { color: var(--positive); } .neg { color: var(--negative); } .warn { color: var(--warning); }
.small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.upper { font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.row { display: flex; align-items: center; gap: 8px; } .row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; } .end { justify-content: flex-end; }
.stack > * + * { margin-top: 16px; } .stack-sm > * + * { margin-top: 10px; }
.grid { display: grid; gap: 12px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- оболочка ---------- */
.app { display: flex; height: 100%; }

/* боковое меню (как Wensity: сворачивается в полоску иконок, плашка активного пункта плавно переезжает) */
.sidebar { position: relative; display: flex; flex-direction: column; width: 228px; flex-shrink: 0; height: 100%;
  background: var(--background); border-right: 1px solid var(--border); overflow: hidden; z-index: 40;
  transition: width 240ms var(--ease), transform 240ms var(--ease); }
.sidebar.collapsed { width: 60px; }
.sb-head { height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 18px; }
.sidebar.collapsed .sb-head { justify-content: center; padding: 0; cursor: pointer; }
.mark { width: 24px; height: 24px; border-radius: 7px; background: var(--brand); color: var(--brand-fg); display: grid; place-items: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sb-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.sb-toggle { margin-left: auto; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: var(--muted-foreground);
  transition: background-color .15s, color .15s, transform .12s var(--ease); }
.sb-toggle:hover { background: var(--selected); color: var(--foreground); }
.sb-toggle:active { transform: scale(.96); }
.sb-nav { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 8px 0;
  scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sb-nav::-webkit-scrollbar { width: 4px; } .sb-nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; }
.sb-nav.scrolling { scrollbar-color: var(--border-strong) transparent; } .sb-nav.scrolling::-webkit-scrollbar-thumb { background: var(--border-strong); }
.sb-section { padding: 4px 0; }
.sb-label { height: 26px; display: flex; align-items: flex-end; padding: 0 18px 6px; white-space: nowrap; transition: opacity .12s; }
.sidebar.collapsed .sb-label { opacity: 0; }
.sb-items { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }
.sb-item { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; line-height: 1.35; color: var(--text-2); white-space: nowrap; user-select: none; transition: color .15s, background-color .15s; }
.sb-item:hover { color: var(--foreground); background: var(--hover); }
.sb-item.active { color: var(--foreground); }
.sb-item.active:hover { background: transparent; }
.sb-item .ic { width: 20px; height: 20px; display: grid; place-items: center; flex-shrink: 0; color: var(--muted-foreground); transition: color .15s; }
.sb-item:hover .ic, .sb-item.active .ic { color: var(--foreground); }
.sb-item .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; transition: opacity .12s; }
.sidebar.collapsed .sb-item { justify-content: center; padding: 7px 0; }
.sidebar.collapsed .sb-item .txt, .sidebar.collapsed .sb-item .count { display: none; }
.pill { position: absolute; left: 8px; right: 8px; top: 0; z-index: 0; border-radius: 10px; background: var(--selected); pointer-events: none;
  transition: transform 320ms cubic-bezier(.34, 1.25, .5, 1), height 320ms var(--ease); }
.count { border-radius: 6px; background: var(--selected); padding: 3px 6px; font-size: 10.5px; font-weight: 500; line-height: 1; color: var(--muted-foreground); }
.count.warn { background: var(--warning-wash); color: var(--warning); }
.sb-foot { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); }
.sidebar.collapsed .sb-foot { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .sb-foot .who { display: none; }
.avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--card-2); }
.who .n { font-size: 12.5px; font-weight: 500; line-height: 1.25; }
.who .e { font-size: 11px; line-height: 1.25; color: var(--muted-foreground); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--canvas); }
.topbar { height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px;
  border-bottom: 1px solid var(--border); background: var(--background); }
.topbar .t { font-size: 14px; font-weight: 600; line-height: 1; }
.topbar .s { font-size: 12px; color: var(--muted-foreground); margin-top: 5px; line-height: 1; }
.search-btn { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; min-width: 220px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); font-size: 12.5px; transition: border-color .15s; }
.search-btn:hover { border-color: var(--border-strong); color: var(--foreground); }
.content { flex: 1; overflow-y: auto; }
.page { padding: 24px; max-width: 1240px; margin: 0 auto; }
.page > * + * { margin-top: 16px; }
.page-head .t { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.page-head .s { font-size: 13px; color: var(--muted-foreground); margin-top: 4px; }
.burger { display: none !important; }
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 35; }

/* ---------- карточки ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; }
.card-head.line { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; font-weight: 600; line-height: 1.2; }
.card-head p { font-size: 12px; color: var(--muted-foreground); margin-top: 5px; }
.card-body { padding: 16px 18px 18px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-top .ic { color: var(--muted-foreground); }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; margin-top: 12px; }
.stat-sub { font-size: 12px; color: var(--muted-foreground); margin-top: 6px; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted-foreground); font-size: 13px; }

/* ---------- кнопки, поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 9px;
  font-size: 13px; font-weight: 500; white-space: nowrap; border: 1px solid transparent;
  transition: background-color .15s, border-color .15s, color .15s, opacity .15s, transform .12s var(--ease); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--foreground); color: var(--background); }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-ghost { border-color: var(--border); background: var(--card); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); border-color: var(--border-strong); }
.btn-quiet { color: var(--muted-foreground); }
.btn-quiet:hover:not(:disabled) { background: var(--hover); color: var(--foreground); }
.btn-danger { color: var(--negative); border-color: var(--border); background: var(--card); }
.btn-danger:hover:not(:disabled) { background: var(--negative-wash); }
.btn-pos { color: var(--positive); border-color: var(--border); background: var(--card); }
.btn-pos:hover:not(:disabled) { background: var(--positive-wash); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 34px; padding: 0; } .btn-sm.btn-icon { width: 30px; }
.field { width: 100%; height: 36px; padding: 0 11px; font-size: 13.5px; color: var(--foreground); background: var(--background);
  border: 1px solid var(--border-strong); border-radius: 9px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.field { height: auto; min-height: 90px; padding: 9px 11px; line-height: 1.55; resize: vertical; }
.field::placeholder { color: var(--faint); }
.field:focus { border-color: var(--foreground); box-shadow: 0 0 0 3px var(--selected); }
select.field { appearance: none; padding-right: 30px; background-repeat: no-repeat; background-position: right 10px center;
  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='%238b8b94' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.label { display: block; font-size: 12px; font-weight: 500; color: var(--muted-foreground); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted-foreground); margin-top: 6px; }
.input-suffix { position: relative; } .input-suffix .field { padding-right: 32px; }
.input-suffix span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); font-size: 13px; pointer-events: none; }

/* ---------- бейджи, переключатели ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 6px; font-size: 11px; font-weight: 500;
  line-height: 1.2; white-space: nowrap; background: var(--selected); color: var(--muted-foreground); }
.b-pos { background: var(--positive-wash); color: var(--positive); } .b-neg { background: var(--negative-wash); color: var(--negative); }
.b-warn { background: var(--warning-wash); color: var(--warning); } .b-accent { background: var(--selected); color: var(--foreground); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; flex-shrink: 0; }
.dot.pos { background: var(--positive); } .dot.neg { background: var(--negative); } .dot.warn { background: var(--warning); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.segmented button { padding: 4px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--muted-foreground); white-space: nowrap; transition: color .15s, background-color .15s; }
.segmented button:hover { color: var(--foreground); }
.segmented button.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow); }
.switch { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--border-strong); transition: background .2s; flex-shrink: 0; }
.switch.on { background: var(--foreground); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--background);
  transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch.on::after { transform: translateX(16px); }
.meter { height: 4px; border-radius: 2px; background: var(--card-2); overflow: hidden; }
.meter > div { height: 100%; border-radius: 2px; background: var(--chart); transition: width .5s var(--ease); }
.divider { height: 1px; background: var(--border); }
.kbd { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; font: 500 10.5px var(--mono); color: var(--muted-foreground);
  background: var(--card-2); border: 1px solid var(--border); border-radius: 5px; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { position: sticky; top: 0; background: var(--card); padding: 9px 18px; text-align: left; font-size: 11.5px; font-weight: 500;
  color: var(--muted-foreground); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 18px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; transition: background-color .12s; }
.table tbody tr.click:hover { background: var(--hover); }
.r { text-align: right !important; }

/* ---------- вкладки ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { padding: 9px 12px; font-size: 13px; font-weight: 500; color: var(--muted-foreground); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s; }
.tabs button:hover { color: var(--foreground); }
.tabs button.active { color: var(--foreground); border-bottom-color: var(--foreground); }

/* ---------- модалки, палитра, тосты ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: var(--overlay); display: flex; justify-content: center; align-items: flex-start;
  padding: 10vh 16px 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-float); }
.modal.wide { max-width: 760px; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 14px; font-weight: 600; }
.modal-body { padding: 18px; } .modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.palette { max-width: 560px; overflow: hidden; }
.palette input { width: 100%; height: 50px; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 0 18px; font-size: 14.5px; color: var(--foreground); outline: none; }
.palette .list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette .item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.palette .item .ic { color: var(--muted-foreground); }
.palette .item.sel { background: var(--selected); color: var(--foreground); }
.palette .item .kind { margin-left: auto; font-size: 11.5px; color: var(--muted-foreground); }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-float);
  padding: 11px 13px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; animation: pop .22s var(--ease); }
.toast.err { border-color: var(--negative); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.fade-in { animation: fade .22s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.spinner { width: 15px; height: 15px; border: 2px solid var(--border-strong); border-top-color: var(--foreground); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- специфичное ---------- */
.html-msg { font-size: 13.5px; line-height: 1.65; word-break: break-word; }
.html-msg code { background: var(--card-2); padding: 1px 5px; border-radius: 5px; }
.lot-card { overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s var(--ease); }
.lot-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.thumb { aspect-ratio: 4 / 3; background: var(--card-2); display: grid; place-items: center; color: var(--faint); overflow: hidden; border-bottom: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.code-row { display: flex; align-items: center; gap: 10px; padding: 9px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
.code-row:last-child { border-bottom: 0; }
.steps { display: flex; flex-direction: column; gap: 1px; padding: 8px; }
.step { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--faint); }
.step .num { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.step.done { color: var(--muted-foreground); cursor: pointer; } .step.done .num { background: var(--selected); border-color: transparent; color: var(--foreground); }
.step.done:hover { background: var(--hover); color: var(--foreground); }
.step.current { color: var(--foreground); background: var(--selected); } .step.current .num { background: var(--foreground); color: var(--background); border-color: transparent; }
.wz-progress { height: 2px; background: var(--border); }
.wz-progress > div { height: 100%; background: var(--foreground); transition: width .3s var(--ease); }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, background-color .15s; background: var(--card); text-align: left; width: 100%; }
.choice:hover { border-color: var(--border-strong); background: var(--hover); }
.choice.selected { border-color: var(--foreground); background: var(--selected); }
.choice .ico { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border); color: var(--muted-foreground); display: grid; place-items: center; flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 11px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; font-weight: 500; background: var(--card); transition: border-color .15s, background-color .15s; }
.chip:hover { border-color: var(--border-strong); } .chip.on { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
.rule { padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6; background: var(--card-2); border: 1px solid var(--border); }
.timeline > div { position: relative; padding: 0 0 14px 18px; border-left: 1px solid var(--border); margin-left: 4px; }
.timeline > div::before { content: ""; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--chart); }
.timeline > div:last-child { padding-bottom: 0; }
.chart-box { position: relative; }
.chart { width: 100%; height: 170px; display: block; overflow: visible; }
.chart-days { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--muted-foreground); }
.chart-tip { position: absolute; pointer-events: none; transform: translate(-50%, -120%); background: var(--foreground); color: var(--background);
  padding: 5px 9px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; z-index: 3; }
.chart-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--chart); border: 2px solid var(--card); transform: translate(-50%, -50%); pointer-events: none; }
.wz-grid { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }


/* ---------- уведомления ---------- */
.page.narrow { max-width: 760px; }
.page.narrow > .card + .card { margin-top: 8px; }
.notif { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.notif.urgent { border-color: color-mix(in srgb, var(--negative) 45%, var(--border)); }
.notif.unread .ntime::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--foreground); margin-right: 6px; vertical-align: 1px; }
.notif.urgent.unread .ntime::before { background: var(--negative); }
.ntext { font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; min-width: 0; }
.ntext a { text-decoration: underline; }
.ntext code { font-family: var(--mono); font-size: 12px; background: var(--selected); padding: 1px 5px; border-radius: 5px; }
.nimg { max-width: 260px; width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.nbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.nbtns .btn { height: auto; min-height: 32px; padding: 6px 11px; white-space: normal; text-align: left; line-height: 1.3; }
.nanswer { padding: 10px 12px; border-radius: 10px; background: var(--card-2); overflow-wrap: anywhere; }
.count.neg { background: var(--negative-wash); color: var(--negative); }
.count.acc { background: var(--foreground); color: var(--background); }

/* ---------- чаты ---------- */
.content-fill { overflow: hidden; display: flex; }
.content-fill > * { flex: 1; min-height: 0; }
.chats { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100%; min-height: 0; }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; min-height: 0; }
.chat-search { position: sticky; top: 0; z-index: 1; display: flex; gap: 6px; padding: 12px; background: var(--canvas); border-bottom: 1px solid var(--border); }
.chat-item { width: 100%; display: flex; gap: 11px; align-items: center; padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); transition: background .12s; }
.chat-item:hover { background: var(--hover); } .chat-item.active { background: var(--selected); }
.chat-item .grow { display: flex; flex-direction: column; gap: 2px; }
.ava { position: relative; width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; background: var(--card-2); display: grid; place-items: center; font-weight: 600; font-size: 14px; color: var(--muted-foreground); }
.ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ava i { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--positive); border: 2px solid var(--canvas); }
.unread-dot { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--foreground); color: var(--background); font-size: 11px; font-weight: 600; display: grid; place-items: center; flex-shrink: 0; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); min-height: 56px; }
.chat-back { display: none !important; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.msg { display: flex; } .msg.mine { justify-content: flex-end; } .msg.sys { justify-content: center; }
.bubble { max-width: min(78%, 560px); padding: 8px 12px 6px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--border); overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--foreground); color: var(--background); border-color: transparent; border-bottom-right-radius: 5px; }
.msg:not(.mine):not(.sys) .bubble { border-bottom-left-radius: 5px; }
.msg.sys .bubble { background: transparent; border: 1px dashed var(--border-strong); font-size: 12.5px; color: var(--muted-foreground); text-align: center; }
.mtext { white-space: pre-wrap; font-size: 13.5px; line-height: 1.45; }
.mtime { font-size: 10.5px; opacity: .55; text-align: right; margin-top: 2px; }
.msg-img { display: block; max-width: 240px; width: 100%; border-radius: 9px; margin: 4px 0; cursor: zoom-in; }
.chat-input { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--canvas); }
.chat-compose { display: flex; gap: 6px; align-items: flex-end; }
.chat-compose textarea.field { height: auto; min-height: 38px; max-height: 160px; padding: 9px 11px; resize: none; field-sizing: content; line-height: 1.4; }
.chat-compose .btn { height: 38px; width: 38px; flex-shrink: 0; }

/* ---------- нижняя панель (телефон) ---------- */
.tabbar { display: none; }
@media (max-width: 1023px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%); box-shadow: var(--shadow-float); width: 248px; }
  .sidebar.collapsed { width: 248px; }
  .sidebar.open { transform: none; }
  .sb-toggle { display: none; }
  .burger { display: inline-flex !important; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: minmax(0, 1fr); } .span2 { grid-column: auto; }
  .search-btn { min-width: 0; } .search-btn .label-text, .search-btn .kbd { display: none; }
  .topbar { padding: 0 16px; } .page { padding: 16px; }
  .tabbar { display: flex; flex-shrink: 0; border-top: 1px solid var(--border); background: var(--card); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar.hidden { display: none; }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; font-size: 10.5px; color: var(--muted-foreground); }
  .tabbar button.active { color: var(--foreground); }
  .tb-ic { position: relative; display: grid; place-items: center; }
  .tb-ic i { position: absolute; top: -5px; left: 13px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-style: normal; font-size: 10px; font-weight: 600;
    background: var(--foreground); color: var(--background); display: grid; place-items: center; }
  .tb-ic i.neg { background: var(--negative); color: #fff; }
  .chats { grid-template-columns: minmax(0, 1fr); }
  .chats .chat-pane { display: none; } .chats.open .chat-pane { display: flex; } .chats.open .chat-list { display: none; }
  .chat-back { display: inline-flex !important; } .chat-head { padding: 8px 10px; }
  .main.chat-open .topbar { display: none; }
}
@media (max-width: 640px) {
  .g2 { grid-template-columns: minmax(0, 1fr); } .wz-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-value { font-size: 21px; }
  .field { height: 40px; font-size: 16px; } textarea.field { font-size: 16px; }
  .table th, .table td { padding: 9px 11px; font-size: 12.5px; }
  .modal-wrap { padding-top: 12px; } .hide-sm { display: none !important; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .card-head { flex-wrap: wrap; }
  .msg-row { flex-wrap: wrap; } .msg-row .msg-label { width: 100% !important; }
  .toasts { left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: none; }
}
.seg-full { display: flex; width: 100%; }
.seg-full button { flex: 1; white-space: normal; text-align: center; line-height: 1.3; padding: 6px 8px; }
@media (max-width: 640px) { .segmented.seg-full { overflow: visible; } }
