/* Стиль демо «КОЛЛЕКТИВ.2.0»: токены совпадают с direct-lp.css, файл самодостаточен. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --accent: #7C3AED; --accent2: #5B21B6;
  --bg: #F6F5FB; --bg2: #FFFFFF; --bg3: #EEEAFB;
  --fg: #150E2E; --muted: #5B6475; --line: rgba(21,14,46,.1);
  --ok: #047857; --ok-bg: #D1FAE5;
  --info: #5B21B6; --info-bg: #EDE9FE;
  --bad: #B91C1C; --bad-bg: #FEE2E2;
  --idle: #475569; --idle-bg: #E2E8F0;
  --warn: #92400E; --warn-bg: #FEF3C7;
  --radius: 16px;
}
html { -webkit-text-size-adjust: 100%; }
body { font-family: 'DM Sans', system-ui, sans-serif; background: var(--bg); color: var(--fg); line-height: 1.5; min-height: 100vh; overflow-x: hidden; }
body.k2-lock { overflow: hidden; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.mono { font-family: 'DM Mono', ui-monospace, monospace; }

.k2-skip { position: absolute; left: -9999px; }
.k2-skip:focus { left: 1rem; top: 1rem; z-index: 200; background: var(--accent); color: #fff; padding: .5rem 1rem; border-radius: 8px; }

/* Шапка */
.k2-top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.k2-top__row { display: flex; align-items: center; gap: 12px; padding: 12px 4%; flex-wrap: wrap; }
.k2-top__sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4% 8px; }
.k2-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.k2-brand__mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-family: 'Unbounded', sans-serif; font-weight: 900; font-size: 13px; color: #fff; }
.k2-brand__name { font-family: 'Unbounded', sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.k2-brand__name span { color: var(--accent); }
.k2-demo-badge { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); background: var(--warn-bg); padding: 4px 12px; border-radius: 40px; }
.k2-back { font-size: 13px; color: var(--muted); text-decoration: none; padding: 8px 4px; min-height: 36px; display: inline-flex; align-items: center; }
.k2-back:hover { color: var(--accent); text-decoration: underline; }
.k2-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.k2-role { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.k2-role select, .k2-field select, .k2-field input, .k2-field textarea {
  min-height: 40px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 14px; max-width: 100%;
}
.k2-role select:focus, .k2-field select:focus, .k2-field input:focus, .k2-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,.18); }
.k2-tabs { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.k2-tabs::-webkit-scrollbar { display: none; }
.k2-tabs ul { list-style: none; display: flex; gap: 6px; }
.k2-tab { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--muted); padding: 8px 14px; border-radius: 40px; min-height: 40px; }
.k2-tab:hover { background: var(--bg3); }
.k2-tab.is-current { background: var(--accent); color: #fff; }
.k2-tab__soon { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; background: var(--idle-bg); color: var(--idle); padding: 1px 7px; border-radius: 10px; }
.k2-tab.is-current .k2-tab__soon { background: rgba(255,255,255,.25); color: #fff; }
.k2-whoami { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Кнопки */
.k2-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 22px; border-radius: 40px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; }
.k2-btn:hover { background: var(--accent2); border-color: var(--accent2); }
.k2-btn:disabled { opacity: .5; cursor: not-allowed; }
.k2-btn--ghost { background: transparent; color: var(--accent); }
.k2-btn--ghost:hover { background: var(--bg3); border-color: var(--accent); }
.k2-btn--sm { min-height: 40px; padding: 8px 16px; font-size: 13px; }

/* Основная область */
.k2-main { max-width: 1280px; margin: 0 auto; padding: 24px 4% 64px; }
.k2-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 500; margin-bottom: .6rem; }
.k2-h2 { font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: clamp(1.05rem, 2.2vw, 1.3rem); line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .7rem; }
.k2-h1 { font-family: 'Unbounded', sans-serif; font-weight: 900; font-size: clamp(1.4rem, 3.4vw, 2.1rem); line-height: 1.15; letter-spacing: -.02em; margin-bottom: .6rem; max-width: 26ch; }
.k2-lead { color: var(--muted); max-width: 46rem; margin-bottom: 1.2rem; }
.k2-text { color: var(--fg); font-size: 15px; }
.k2-note { font-size: 12px; color: var(--muted); }

/* Главная */
.k2-hero { padding: 16px 0 8px; }
.k2-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px; list-style: none; }
.k2-card { display: flex; flex-direction: column; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-decoration: none; height: 100%; }
.k2-card:hover { border-color: var(--accent); box-shadow: 0 16px 40px -28px rgba(76,29,149,.5); }
.k2-card__n { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--accent); }
.k2-card h2 { font-size: 16px; font-weight: 600; }
.k2-card p { font-size: 13.5px; color: var(--muted); }
.k2-card__tag { margin-top: auto; align-self: flex-start; font-size: 11px; padding: 2px 10px; border-radius: 40px; background: var(--ok-bg); color: var(--ok); }
.k2-card__tag--soon { background: var(--idle-bg); color: var(--idle); }
.k2-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 8px; }
.k2-kpi { background: var(--bg2); padding: 16px; }
.k2-kpi b { display: block; font-family: 'DM Mono', monospace; font-size: 1.6rem; font-weight: 500; color: var(--accent); }
.k2-kpi span { font-size: 13px; color: var(--muted); }
.k2-kpi--bad b { color: var(--bad); }
.k2-howto { margin-top: 20px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; font-size: 14px; color: var(--muted); }
.k2-howto strong { color: var(--fg); }

.k2-soon { max-width: 40rem; padding: 40px 0; }

/* Панель инструментов модуля */
.k2-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 14px 0; }
.k2-field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.k2-field select { min-width: 190px; }
.k2-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.k2-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 14px; border-radius: 40px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; min-height: 36px; }
.k2-chip b { font-family: 'DM Mono', monospace; font-weight: 500; }
.k2-chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.k2-chip--bad b { color: var(--bad); }
.k2-chip--warn b { color: var(--warn); }

/* Статусы */
.st { --c: var(--idle); --b: var(--idle-bg); }
.st--approved { --c: var(--ok); --b: var(--ok-bg); }
.st--inwork { --c: var(--info); --b: var(--info-bg); }
.st--stuck { --c: var(--bad); --b: var(--bad-bg); }
.st--queue { --c: var(--idle); --b: var(--idle-bg); }
.st--na { --c: #64748B; --b: transparent; }
.k2-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 40px; background: var(--b); color: var(--c); white-space: nowrap; }
.k2-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Матрица */
.k2-scroll { overflow-x: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.mx { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 860px; }
.mx th, .mx td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; text-align: center; vertical-align: middle; }
.mx th:last-child, .mx td:last-child { border-right: 0; }
.mx tbody tr:last-child th, .mx tbody tr:last-child td { border-bottom: 0; }
.mx thead th { background: var(--bg3); font-size: 12px; font-weight: 600; padding: 10px 6px; position: sticky; top: 0; }
.mx thead th small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.mx .mx-obj { text-align: left; padding: 10px 14px; min-width: 210px; position: sticky; left: 0; background: var(--bg2); z-index: 2; box-shadow: 1px 0 0 var(--line); }
.mx thead .mx-obj { background: var(--bg3); z-index: 3; }
.mx-obj b { display: block; font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent); font-weight: 500; }
.mx-obj span { display: block; font-size: 13px; line-height: 1.3; font-weight: 500; }
.mx-obj small { color: var(--muted); font-size: 11px; font-weight: 400; }
.mx-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; min-height: 64px; padding: 6px 4px; border: 0; background: var(--b); color: var(--c); cursor: pointer; font-size: 12px; font-weight: 600; line-height: 1.2; }
.mx-cell small { font-family: 'DM Mono', monospace; font-weight: 400; font-size: 11px; }
.mx-cell:hover { filter: brightness(.96); }
.mx-cell:focus-visible { outline-offset: -3px; }
.mx-cell.is-stale { box-shadow: inset 0 0 0 2px var(--bad); }
.mx-cell.is-stale small::after { content: " ⚠"; }
.mx-cell.st--na { font-weight: 400; color: #94A3B8; }
.mx-dim { opacity: .28; }

.k2-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.k2-empty { padding: 28px; text-align: center; color: var(--muted); }

/* Рабочее место ячейки */
.wp { display: grid; gap: 18px; }
.wp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.wp-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.wp-meta div { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.wp-meta dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.wp-meta dd { font-weight: 500; }
.wp h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wp-list { list-style: none; display: grid; gap: 6px; }
.wp-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 8px 12px; background: var(--bg); border-radius: 10px; }
.wp-list li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.wp-list .k2-note { white-space: nowrap; }
.wp-feed { list-style: none; border-left: 2px solid var(--line); padding-left: 14px; display: grid; gap: 10px; margin-left: 4px; }
.wp-feed li { position: relative; font-size: 13.5px; }
.wp-feed li::before { content: ""; position: absolute; left: -20px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg2); }
.wp-feed time { display: block; font-size: 11px; color: var(--muted); }
.wp-action { background: var(--bg3); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.wp-action .k2-field select, .wp-action .k2-field input { width: 100%; }
.wp-lock { font-size: 13px; color: var(--warn); background: var(--warn-bg); padding: 10px 12px; border-radius: 12px; }

/* Модалки */
.k2-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(21,14,46,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.k2-modal { background: var(--bg2); border-radius: 20px; width: min(720px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px -30px rgba(21,14,46,.6); }
.k2-modal--small { width: min(440px, 100%); }
.k2-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.k2-modal__title { font-family: 'Unbounded', sans-serif; font-size: 1rem; line-height: 1.3; }
.k2-modal__x { flex: none; width: 44px; height: 44px; margin: -8px -8px 0 0; border: 0; background: transparent; border-radius: 50%; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.k2-modal__x:hover { background: var(--bg3); }
.k2-modal__body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.k2-modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Тосты */
.k2-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: grid; gap: 8px; max-width: calc(100vw - 32px); }
.k2-toast { background: var(--fg); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 12px 30px -12px rgba(21,14,46,.6); }
.k2-toast--ok { background: var(--ok); }
.k2-toast--bad { background: var(--bad); }

/* Таблицы общего назначения (для модулей) */
.k2-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.k2-table th, .k2-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.k2-table th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg3); white-space: nowrap; }
.k2-table tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 900px) {
  .k2-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .k2-top__row { gap: 8px; padding: 10px 4%; }
  .k2-demo-badge { font-size: 10px; padding: 3px 10px; }
  .k2-tools { margin-left: 0; width: 100%; justify-content: space-between; }
  .k2-whoami { display: none; }
  .mx { min-width: 760px; }
  .mx .mx-obj { min-width: 124px; max-width: 124px; padding: 8px 8px; }
  .mx-obj span { font-size: 12px; }
  .mx-obj small { display: none; }
  .k2-cards { grid-template-columns: 1fr; }
  .k2-field select { min-width: 0; width: 100%; }
  .k2-bar > .k2-field { flex: 1 1 100%; }
  .k2-backdrop { padding: 0; align-items: stretch; }
  .k2-modal { width: 100%; max-height: none; border-radius: 0; }
  .k2-modal--small { width: 100%; max-height: none; border-radius: 0; margin-top: auto; height: auto; }
  .k2-backdrop:has(.k2-modal--small) { align-items: flex-end; }
  .k2-modal--small { border-radius: 20px 20px 0 0; }
  .k2-modal__foot .k2-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
