/* SAOSAO — компоненты интерфейса */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
.muted { color: var(--muted); } .text-2 { color: var(--text-2); }
.small { font-size: 12px; } .tiny { font-size: 11px; } .mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; } .right { margin-left: auto; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.grid { display: grid; gap: 16px; }
.grid-1 { grid-template-columns: minmax(0, 1fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: fixed; inset: 0 auto 0 0; z-index: 40;
  background: var(--bg-elev); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  transition: transform var(--t) var(--ease);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-logo { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--grad); box-shadow: var(--glow); }
.brand-logo svg { width: 18px; height: 18px; color: #fff; }
.brand-name { font-weight: 750; letter-spacing: .02em; font-size: 15px; }
.brand-name span { font-weight: 500; color: var(--muted); margin-left: 4px; font-size: 11px; letter-spacing: .1em; }
.company-switch {
  margin: 4px 12px 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: border-color var(--t-fast);
}
.company-switch:hover { border-color: var(--border-strong); }
.company-switch .avatar { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.nav-section { font-size: 10.5px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 520; text-decoration: none; position: relative; transition: background var(--t-fast), color var(--t-fast);
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav a.active svg { color: var(--accent); opacity: 1; }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav a.locked { opacity: .5; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.plan-card { padding: 12px; border-radius: var(--radius); background: var(--grad-soft); border: 1px solid var(--border); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--border);
}
.search-global { position: relative; width: min(420px, 40vw); }
.search-global input { padding-left: 36px; background: var(--surface); }
.search-global > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 5px; color: var(--muted); }
.content { padding: 28px; max-width: 1480px; width: 100%; margin: 0 auto; animation: fadeUp var(--t-slow) var(--ease); }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .subtitle { color: var(--muted); margin-top: 4px; }
.page-head > .grow { flex: 1 1 260px; min-width: 0; }
.menu-toggle, .btn.menu-toggle { display: none; }
.offline-banner { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; padding: 10px 16px; border-radius: 999px; background: var(--warning); color: #1c1400; font-weight: 600; box-shadow: var(--shadow); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; }
.card-head h3.grow { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head .input, .card-head select { width: auto; flex: 0 0 auto; min-width: 170px; max-width: 260px; }
.card-body { padding: 18px 20px; }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; transition: transform var(--t) var(--ease), border-color var(--t); }
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 8px; }
.kpi-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-value { font-size: 28px; font-weight: 720; letter-spacing: -.02em; margin-top: 12px; font-variant-numeric: tabular-nums; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.delta { font-weight: 650; display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: 6px; }
.delta.up { color: var(--success); background: var(--success-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--muted); background: var(--surface-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 580; cursor: pointer;
  white-space: nowrap; transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast); user-select: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px rgba(124,108,246,.8); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; } .btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); height: 28px; padding: 0 12px; border-radius: 7px; font: inherit; font-weight: 580; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 14px; height: 14px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 580; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--danger); }
.field.has-error .input { border-color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius-sm); background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border-strong); font: inherit; outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 32px; 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='%237D8496' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder { color: var(--muted); }
.input-sm { height: 32px; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 22px; cursor: pointer; transition: background var(--t); }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform var(--t) var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 160px; }
.toolbar .search { position: relative; }
.toolbar .search input { padding-left: 34px; width: 260px; }
.toolbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }

/* ---------- badges, avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 620; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.tag { display: inline-flex; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; letter-spacing: .02em; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; } .avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-stack { display: flex; } .avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; } .avatar-stack .avatar:first-child { margin-left: 0; }
.progress { height: 6px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--grad); border-radius: 6px; transition: width var(--t-slow) var(--ease); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; } .table th.sortable:hover { color: var(--text); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pagination { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kan-col { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kan-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 650; font-size: 13px; }
.kan-head .cnt { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface-2); padding: 0 7px; border-radius: 6px; }
.kan-list { padding: 4px 10px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; transition: background var(--t-fast); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.kan-list.drop { background: var(--accent-soft); }
.kan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: grab; transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast); }
.kan-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kan-card.dragging { opacity: .45; transform: rotate(1.5deg); }
.kan-card .title { font-weight: 600; margin: 6px 0 8px; line-height: 1.35; }
.kan-card .meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

/* ---------- modal, drawer, toast, menu ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 70; display: grid; place-items: center; padding: 24px; animation: fadeIn var(--t) var(--ease); backdrop-filter: blur(3px); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); animation: pop var(--t-slow) var(--ease); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }
.drawer-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 60; animation: fadeIn var(--t); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--surface); border-left: 1px solid var(--border-strong); z-index: 61; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideIn var(--t-slow) var(--ease); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 280px; max-width: 420px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: pop var(--t-slow) var(--ease); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.success svg { color: var(--success); } .toast.error svg { color: var(--danger); } .toast.info svg { color: var(--info); }
.toast .t-title { font-weight: 650; } .toast .t-body { color: var(--text-2); font-size: 13px; }
.menu { position: fixed; z-index: 80; min-width: 200px; padding: 6px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: pop var(--t) var(--ease); }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu button svg, .menu a svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.menu .danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 2px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--muted); padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .cnt { font-size: 11px; background: var(--surface-3); padding: 0 6px; border-radius: 5px; }

/* ---------- skeleton & empty ---------- */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); animation: shimmer 1.3s infinite; }
[data-theme="light"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 20px; color: var(--muted); gap: 10px; }
.empty-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--grad-soft); border: 1px solid var(--border); color: var(--accent); margin-bottom: 6px; }
.empty-ico svg { width: 26px; height: 26px; }
.empty h3 { color: var(--text); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------- lists, timeline ---------- */
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
a.list-item { color: inherit; text-decoration: none; transition: background var(--t); }
a.list-item:hover { background: var(--surface-2); }
a.list-item .bold { color: var(--text); }
.card > .list-item, .card > div > .list-item { padding-left: 20px; padding-right: 20px; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: var(--border-strong); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; }
.kv dt { color: var(--muted); font-size: 13px; } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment .bubble { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 12px; border-radius: 4px 12px 12px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.check-item:hover { background: var(--surface-2); }
.check-item.done span { text-decoration: line-through; color: var(--muted); }

/* ---------- chat ---------- */
.chat-layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--topbar-h) - 56px); min-height: 480px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-list-items { overflow-y: auto; flex: 1; padding: 6px; }
.chat-item { display: flex; gap: 10px; padding: 10px; border-radius: var(--radius); cursor: pointer; align-items: center; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--accent-soft); }
.chat-item .unread { min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.msg { display: flex; gap: 10px; max-width: 74%; margin-top: 8px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 9px 12px; position: relative; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .bubble { background: linear-gradient(135deg, rgba(124,108,246,.28), rgba(91,140,255,.22)); border-color: rgba(124,108,246,.35); border-radius: 14px 4px 14px 14px; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.msg.mine .meta { justify-content: flex-end; }
.msg .reply-quote { border-left: 2px solid var(--accent); padding: 2px 8px; margin-bottom: 6px; font-size: 12px; color: var(--text-2); background: rgba(0,0,0,.12); border-radius: 0 6px 6px 0; }
.msg .actions { opacity: 0; display: flex; gap: 2px; align-self: center; transition: opacity var(--t-fast); }
.msg:hover .actions { opacity: 1; }
.msg img.attach { max-width: 280px; max-height: 220px; border-radius: 10px; display: block; margin-top: 4px; cursor: zoom-in; }
.msg .file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,.15); color: var(--text); margin-top: 4px; }
.msg .deleted { font-style: italic; color: var(--muted); }
/* поддержка как чат (core/support-chat.js) */
.support-chat .support-back { display: none; }
.support-chat .chat-list .chat-head { padding: 12px 14px; }
.support-chat .chat-item .badge { flex: none; }
@media (max-width: 980px) { .support-chat .support-back { display: inline-flex; } }
.day-sep { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--surface-2); padding: 2px 10px; border-radius: 999px; margin: 14px 0 6px; }
.composer { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 40px; max-height: 160px; height: 40px; resize: none; padding-top: 9px; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; }

/* ---------- charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.bar-track { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 6px; background: var(--grad); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(1200px 600px at -10% -10%, rgba(124,108,246,.35), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(56,211,232,.22), transparent 60%), var(--bg-elev); border-right: 1px solid var(--border); }
.auth-side h1 { font-size: 40px; line-height: 1.1; max-width: 520px; letter-spacing: -.03em; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; color: var(--text-2); max-width: 460px; }
.auth-feature .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--accent); flex-shrink: 0; }
.auth-feature .ico svg { width: 17px; height: 17px; }
.auth-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; animation: fadeUp var(--t-slow) var(--ease); }
.auth-form h2 { font-size: 26px; letter-spacing: -.02em; }

/* ---------- misc ---------- */
.ai-result { white-space: pre-wrap; line-height: 1.65; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; overflow-wrap: anywhere; }
.feature-tile { padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color var(--t), transform var(--t) var(--ease), background var(--t); display: flex; flex-direction: column; gap: 8px; }
.feature-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature-tile.active { border-color: var(--accent); background: var(--accent-soft); }
.feature-tile .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--grad-soft); color: var(--accent); }
.feature-tile .ico svg { width: 18px; height: 18px; }
.plan { padding: 22px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 12px; position: relative; }
.plan.current { border-color: var(--accent); box-shadow: var(--glow); }
.plan .price { font-size: 30px; font-weight: 750; letter-spacing: -.02em; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 13px; }
.plan li::before { content: "✓"; color: var(--success); margin-right: 8px; font-weight: 700; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.notice.warning { background: var(--warning-soft); border-color: transparent; } .notice.warning svg { color: var(--warning); }
.notice.info { background: var(--info-soft); border-color: transparent; } .notice.info svg { color: var(--info); }
.notice.success { background: var(--success-soft); border-color: transparent; } .notice.success svg { color: var(--success); }
.notice.danger { background: var(--danger-soft); border-color: transparent; } .notice.danger svg { color: var(--danger); }
.notif { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--accent-soft); }
.notif .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent); flex-shrink: 0; }
.notif .ico svg { width: 16px; height: 16px; }
.icon-dot { position: relative; }
.icon-dot[data-count]:not([data-count="0"])::after { content: attr(data-count); position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.drop-zone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color var(--t), background var(--t); }
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.file-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 10px; font-weight: 800; text-transform: uppercase; flex-shrink: 0; }
.stars { color: var(--warning); letter-spacing: 2px; }
.lightbox { max-width: 92vw; max-height: 88vh; border-radius: 12px; box-shadow: var(--shadow-lg); }


/* ---------- utilities (доп.) ---------- */
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .mt-12 { margin-top: 12px; } .mb-8 { margin-bottom: 8px; } .mt-4 { margin-top: 4px; }
.between { justify-content: space-between; } .center { text-align: center; } .bold { font-weight: 650; } .danger-text { color: var(--danger); } .success-text { color: var(--success); }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.kan-list .drop-hint { height: 3px; border-radius: 3px; background: var(--accent); margin: -2px 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; }
.stat-mini { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.stat-mini b { font-size: 18px; font-variant-numeric: tabular-nums; }
.read-tick { color: var(--accent); font-weight: 700; letter-spacing: -3px; }
.via-tag { font-size: 10px; padding: 0 5px; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
.typing-pad { height: 16px; }
.portal-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 0 28px; height: var(--topbar-h); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); }
.portal-nav { display: flex; gap: 4px; overflow-x: auto; }
.portal-nav a { padding: 7px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 560; white-space: nowrap; text-decoration: none; }
.portal-nav a:hover { background: var(--surface); color: var(--text); }
.portal-nav a.active { background: var(--accent-soft); color: var(--text); }
.portal-content { max-width: 1100px; margin: 0 auto; padding: 28px 24px; animation: fadeUp var(--t-slow) var(--ease); }
@media (max-width: 760px) { .portal-top { padding: 0 12px; } .portal-content { padding: 18px 12px; } .filters .input { min-width: 0; flex: 1; } }


/* ---------- portal / admin helpers ---------- */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.portal-top .brand-logo { flex-shrink: 0; }
.admin-tag { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--danger-soft); color: var(--danger); margin-left: 6px; }
.health-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.health-row:last-child { border-bottom: 0; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
pre.trace { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font: 11.5px/1.5 var(--mono); max-height: 320px; overflow: auto; white-space: pre-wrap; color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menu-toggle, .btn.menu-toggle { display: inline-flex; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; } .span-2, .span-3 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; } .auth-side { display: none; }
  .chat-layout { grid-template-columns: 1fr; } .chat-layout.has-active .chat-list { display: none; } .chat-layout:not(.has-active) .chat-main { display: none; }
  .search-global { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 18px 14px; } .topbar { padding: 0 14px; }
  .grid-4 { grid-template-columns: 1fr; } .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; }
  .toolbar .search input { width: 100%; } .toolbar .search { flex: 1; }
  .msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 760px) { .hide-mobile { display: none !important; } .portal-top .brand-name { display: none; } }

/* ---------- демо: баннер с переключением ролей ---------- */
.demo-banner { flex-wrap: wrap; row-gap: 10px; }
.demo-banner .grow { min-width: 260px; }
.demo-roles { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.demo-roles .tiny { margin-right: 2px; }
.demo-role-current { background: var(--accent-soft, rgba(124, 108, 246, .16)); border-color: transparent; cursor: default; font-weight: 600; }
@media (max-width: 720px) { .demo-banner .grow { min-width: 100%; } }
.demo-banner .demo-short { display: none; }
@media (max-width: 720px) {
  .demo-banner { margin: 10px 12px 0 !important; padding: 10px 12px; gap: 8px; row-gap: 8px; font-size: 13px; }
  .demo-banner > svg { display: none; }
  .demo-banner .demo-long { display: none; }
  .demo-banner .demo-short { display: inline; }
  .demo-roles { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .demo-roles::-webkit-scrollbar { display: none; }
  .demo-roles .btn { padding: 4px 8px; font-size: 12.5px; white-space: nowrap; }
  .demo-banner > .btn-primary { padding: 5px 10px; font-size: 12.5px; }
}

/* ---------- юридические согласия (регистрация, экран принятия документов) ---------- */
.consents { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev); }
.consent { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.consent input { width: 17px; height: 17px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.consent a { color: var(--accent); }
.consent-req { color: var(--danger); }
.consent-row .error { margin: 4px 0 0 27px; }
.legal-gate-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.legal-gate-list a { color: var(--accent); }
.auth-legal { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.auth-legal a { color: var(--text-2); }
.legal-docs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
.legal-docs a { font-size: 13.5px; }
.consent-log { font-size: 12.5px; }
@media (max-width: 640px) { .legal-docs { grid-template-columns: 1fr; } }

.consent-note { font-size: 12px; color: var(--text-3, var(--text-2)); line-height: 1.45; margin-top: 2px; }
/* уведомление о cookie (общий скрипт cookie-notice.js) */
.ck-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1000; max-width: 560px; margin: 0 auto; display: flex; gap: 12px;
  align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-elev, var(--bg-2));
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35); font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.ck-banner p { margin: 0; flex: 1 1 260px; }
.ck-banner a { color: var(--accent); }
.ck-banner .ck-actions { display: flex; gap: 8px; }
