/* Карта AI-внедрения Friends. Стиль — тот же, что у Unchaos (_planner) и Talent (_talent), из
   презентационного шаблона агентства: серо-голубой фон, крупный гротеск, монохром и сливовый акцент.
   Прямые углы, без теней: всё разделяется линиями и сменой фона. */
@font-face { font-family: Inter; font-weight: 400 800; font-display: swap; src: url(/fonts/inter-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Inter; font-weight: 400 800; font-display: swap; src: url(/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 600; font-display: swap; src: url(/fonts/jbmono-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 600; font-display: swap; src: url(/fonts/jbmono-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #E1E9EB; --paper: #fff; --ink: #141414; --plum: #674258; --plum-d: #4A2F3F;
  --sec: #7A9099; --muted: #5E747C; --nav-off: #93A6AD; --dark: #3A4448;
  --line-g: #B9C9CF; --line: #CBD8DC; --line-w: #DCE4E7; --fill: #C5D3D8; --yellow: #F5F599;
  --font: Inter, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --b: 1.5px solid var(--ink);
}
* { box-sizing: border-box; border-radius: 0; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.45; }
body:has(main.view-item) { background: var(--paper); --row-line: var(--line-w); }
a { color: var(--ink); }
h1 { font-size: 72px; font-weight: 800; line-height: .95; letter-spacing: -.035em; margin: 0; text-wrap: balance; }
h1 small { display: block; font-size: inherit; color: var(--sec); }
h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 40px 0 16px; padding-bottom: 10px; border-bottom: var(--b); }
h3 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; margin: 0; }
h2 small { margin-left: 10px; font: 500 14px var(--mono); }
h4 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 28px 0 14px; padding-bottom: 8px; border-bottom: var(--b); }
small { font-size: 12px; }
[hidden] { display: none !important; }
.boot { padding: 80px 20px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.hint { font-size: 15px; color: var(--muted); margin: 0 0 20px; max-width: 900px; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 1px; }

/* шапка */
header.top { display: grid; grid-template-columns: 240px 1fr auto; align-items: center; padding: 24px 40px; border-bottom: 1px solid var(--row-line, var(--line)); }
.brand { display: inline-flex; align-items: baseline; height: 29px; white-space: nowrap; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 24px; letter-spacing: -.02em; line-height: 29px; }
.brand span { font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-left: 8px; }
.nav { display: flex; gap: 32px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 16px; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.user { position: relative; display: flex; align-items: center; }
.user-btn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 4px 0; white-space: nowrap; }
.user-btn:hover { color: var(--ink); }
.caret { margin-left: 5px; }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--paper); border: var(--b); min-width: 190px; z-index: 30; }
.user-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; padding: 11px 14px; cursor: pointer; color: var(--ink); }
.user-menu button + button { border-top: 1px solid var(--line-w); }
.user-menu button:hover { background: var(--bg); }
main { padding: 32px 40px 60px; }
.crumbs { margin-bottom: 20px; font-size: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

/* кнопки и поля */
.btn { background: var(--plum); color: #fff; border: 1.5px solid var(--plum); padding: 9px 14px; font: 500 14px var(--font); cursor: pointer; white-space: nowrap; transition: background-color .12s; }
.btn:hover:not(:disabled) { background: var(--plum-d); border-color: var(--plum-d); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: rgba(255,255,255,.5); border-color: var(--ink); }
.btn.sm { padding: 9px 14px; }
.btn.danger.ghost { background: none; border-color: transparent; color: var(--plum); padding-left: 0; }
.btn.danger.ghost:hover:not(:disabled) { background: none; border-color: transparent; text-decoration: underline; }
.icon-btn { background: none; border: 0; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 3px 7px; }
.icon-btn:hover:not(:disabled) { color: var(--plum); }
input, select, textarea { font: 400 15px var(--font); padding: 0 12px; height: 40px; border: var(--b); background: var(--paper); color: var(--ink); max-width: 100%; }
textarea { height: auto; padding: 10px 12px; width: 100%; resize: vertical; }
select { padding-right: 30px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--plum); box-shadow: inset 0 0 0 1px var(--plum); }
input[type=checkbox] { appearance: none; width: 20px; height: 20px; padding: 0; margin: 0; flex: none; border: var(--b); background: var(--paper); cursor: pointer; display: inline-grid; place-items: center; }
input[type=checkbox]:checked { background: var(--ink); }
input[type=checkbox]:checked::after { content: "✓"; color: #fff; font: 700 13px/1 var(--font); }
input[type=checkbox]:focus { box-shadow: none; border-color: var(--ink); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); border-color: var(--line-g); cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; min-width: 0; }
.field > input, .field > select, .field > textarea { width: 100%; }
.field > input, .field > select { height: 44px; }
.field-label { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; margin-bottom: 18px; }

/* Панель контролов: соседние элементы делят рамку, даже когда ряд переносится. */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; margin: 0 0 20px; font-size: 14px; }
.toolbar > * { margin: 0 -1.5px -1.5px 0; }
.toolbar > select, .toolbar > input, .toolbar > .btn { height: 40px; padding-top: 0; padding-bottom: 0; }
.toolbar > .check { height: 40px; display: inline-flex; align-items: center; gap: 9px; padding: 0 14px; border: var(--b); white-space: nowrap; }
.toolbar select, .toolbar input:not([type=checkbox]) { background-color: transparent; }
.toolbar:has(> h1) { align-items: flex-end; margin-bottom: 32px; }
.toolbar > h1 { margin: 0 auto 0 0; padding-right: 32px; }
.toolbar > h1 + * { margin-left: 0; }
.seg, .tabs { display: inline-flex; border: var(--b); }
.seg button, .tabs button { background: transparent; border: 0; font: 500 14px var(--font); padding: 0 14px; height: 37px; cursor: pointer; color: var(--muted); white-space: nowrap; transition: background-color .12s; }
.seg button + button, .tabs button + button { border-left: var(--b); }
.seg button:hover:not(.on), .tabs button:hover:not(.on) { color: var(--ink); background: rgba(255,255,255,.5); }
.seg button.on, .tabs button.on { background: var(--ink); color: #fff; }
.tabs { margin: 0 0 24px; }
.tab-n { font: 500 12px var(--mono); opacity: .7; }

/* показатели, таблицы */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; border-top: var(--b); padding-top: 18px; margin: 0 0 36px; }
.card .lbl { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card .val { font-size: clamp(24px, 2.3vw, 34px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-top: 6px; white-space: nowrap; }
.card .note { font-size: 13px; color: var(--muted); margin-top: 4px; }
.card.hi .val { color: var(--plum); }
.panel { margin-bottom: 8px; }
.empty { padding: 28px 0; font-size: 15px; color: var(--muted); }
.scroll { overflow-x: auto; }
.tbl { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.tbl th { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px 10px 0; text-align: left; white-space: nowrap; border-bottom: var(--b); vertical-align: bottom; }
.tbl td { border-bottom: 1px solid var(--row-line, var(--line-g)); padding: 14px 14px 14px 0; vertical-align: top; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl td b { font-weight: 600; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl td.num { font: 500 14px var(--mono); }
.tbl tfoot td { font-weight: 700; border-top: var(--b); border-bottom: 0; }
.tbl.hover tbody tr { cursor: pointer; }
.tbl.hover tbody tr:not(.grp):hover td { background: rgba(255,255,255,.4); }
.tbl.hover td:first-child b { font-size: 17px; font-weight: 700; }
.tbl tr.archived td { color: var(--muted); }
.tbl.narrow-l { max-width: 1100px; }
.pill { display: inline-block; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; border: var(--b); white-space: nowrap; vertical-align: middle; }
.pill.warn-p { font-size: 10px; padding: 2px 6px; border: 1px solid var(--plum); color: var(--plum); }

/* окна — панель справа */
.modal-back { position: fixed; inset: 0; background: rgba(20,20,20,.35); z-index: 50; display: flex; justify-content: flex-end; }
.modal { background: var(--paper); width: 600px; max-width: 100vw; height: 100%; display: flex; flex-direction: column; border-left: 1px solid var(--ink); }
.modal.wide { width: 760px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 28px 32px 18px; border-bottom: var(--b); }
.modal-head .icon-btn { font-size: 28px; color: var(--ink); padding: 0 4px; }
.modal-body { padding: 24px 32px; flex: 1; overflow-y: auto; }
.modal-body .hint { font-size: 13px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 32px; border-top: var(--b); }
.modal-foot .btn { padding: 12px 18px; }
.modal-foot .btn.danger { margin-right: auto; }
.confirm-text { margin: 4px 0 12px; font-size: 16px; }
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; font-size: 14px; max-width: 420px; }
.toast.err { background: var(--plum); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font: 500 12px var(--mono); }
.hint-block { margin-top: 32px; max-width: 900px; }
.hint-block .hint { margin-bottom: 8px; }

/* вход */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--plum); }
.auth-card { background: var(--paper); padding: 40px; width: 100%; max-width: 460px; display: flex; flex-direction: column; }
.auth-card h2 { font-size: 40px; letter-spacing: -.03em; line-height: 1; border: 0; padding: 0; margin: 12px 0 14px; }
.auth-card .hint { font-size: 15px; color: var(--dark); }
.auth-card .field > input { height: 48px; }
.auth-card .btn { height: 52px; font-size: 16px; }
.pw { position: relative; display: block; }
.pw input { width: 100%; height: 44px; padding-right: 96px; }
.auth-card .pw input { height: 48px; }
.pw-eye { position: absolute; right: 0; top: 0; bottom: 0; padding: 0 14px; background: none; border: 0; cursor: pointer; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pw-eye:hover { color: var(--ink); }
.auth-brand { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--plum); }
.auth-error { color: var(--plum); font-size: 13px; min-height: 20px; margin-bottom: 6px; }

/* ---------------------------------------------------------------- карта */

/* статусы: внедрено — сплошная чёрная, в работе — слива, план — рамка, идея — пунктир */
.pill.st-done { background: var(--ink); color: #fff; }
.pill.st-build { background: var(--plum); border-color: var(--plum); color: #fff; }
.pill.st-plan { border-color: var(--ink); }
.pill.st-idea { border-style: dashed; border-color: var(--sec); color: var(--muted); }

/* приоритет прямо в строке: выпадающий список, окрашенный по значению */
.prio { height: 30px; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; padding: 0 26px 0 8px;
  border: 1.5px solid var(--ink); background-color: transparent; background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%; }
.prio.p-high { background-color: var(--yellow); }
.prio.p-low { border-color: var(--line-g); color: var(--muted); }
.prio:disabled { opacity: 1; }

.filters { margin-bottom: 24px; }
.filters > .search { width: 320px; }
.filters > select { max-width: 240px; }
.map-tbl td.name { min-width: 280px; max-width: 520px; }
.map-tbl td.name small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.4; }
.map-tbl td.area { color: var(--dark); min-width: 140px; }
.map-tbl td.store { max-width: 220px; overflow-wrap: anywhere; color: var(--dark); font-size: 13px; }
.map-tbl td.store a { color: var(--ink); text-decoration-color: var(--line-g); }
.map-tbl td.cm { font: 500 13px var(--mono); color: var(--muted); text-align: right; }
.steps-n { display: block; font: 500 11px var(--mono); color: var(--muted); margin-top: 6px; }

/* шапки групп: сплошная полоса, чтобы не сливались со строками */
.map-tbl tr.grp td, .map-tbl tr.grp:hover td { background: var(--sec); color: var(--paper); padding: 11px 14px; border-bottom: 0; cursor: default; }
.map-tbl tr.grp td b { color: var(--paper); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.map-tbl tr.grp td small { color: var(--paper); opacity: .8; font: 500 12px var(--mono); margin-left: 8px; }
.map-tbl tbody tr:not(.grp) + tr.grp td { border-top: 18px solid var(--bg); }

/* обзор */
.dir-tbl td { vertical-align: middle; }
.dir-tbl td:first-child b { font-size: 17px; }
.bar { display: flex; width: 180px; height: 10px; background: var(--paper); border: 1px solid var(--line-g); }
.bar span { display: block; height: 100%; }
.b-done { background: var(--ink); }
.b-build { background: var(--plum); }
.b-plan { background: var(--sec); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: -4px 0 16px; }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.feed { list-style: none; padding: 0; margin: 0; max-width: 1100px; }
.feed li { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-g); }
.feed time { font: 500 12px var(--mono); color: var(--muted); padding-top: 2px; }
.feed a { font-weight: 600; text-decoration: none; }
.feed a:hover { text-decoration: underline; }
.feed .who { color: var(--muted); }

/* карточка */
.toolbar.head { align-items: center; margin-bottom: 28px; }
.toolbar.head .crumbs { margin: 0 auto 0 0; }
.proj-title { font-size: 72px; max-width: 1200px; }
.proj-sub { font-size: 24px; font-weight: 500; color: var(--sec); margin: 14px 0 36px; }
.status-bar { display: flex; gap: 28px; flex-wrap: wrap; margin: -12px 0 32px; }
.status-group { display: flex; flex-direction: column; gap: 6px; }
.status-bar .seg button.on.st-build { background: var(--plum); }
.status-bar .seg button.on.p-high { background: var(--yellow); color: var(--ink); }
.key-cards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.key-cards .val { white-space: normal; font-size: 28px; }
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 48px; align-items: start; }
.col-main .panel h2 { margin-top: 8px; }
.col-main .panel + .panel { margin-top: 32px; }
.summary { font-size: 17px; line-height: 1.5; max-width: 780px; white-space: pre-line; margin: 0 0 16px; }
.steps { list-style: none; padding: 0; margin: 0; max-width: 780px; }
.steps li { border-bottom: 1px solid var(--line-w); }
.steps label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; font-size: 16px; cursor: pointer; }
.steps li.done span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-g); }
.comment { border-bottom: 1px solid var(--line-w); padding: 12px 0; }
.comment p { margin: 6px 0 0; white-space: pre-line; max-width: 780px; }
.comment-head { display: flex; align-items: baseline; gap: 2px; font-size: 13px; }
.comment-head .icon-btn { margin-left: auto; font-size: 18px; }
.comment-add { margin-top: 16px; }
.comment-add .btn { margin-top: 10px; }
.col-side .side { border-top: var(--b); padding: 14px 0 22px; }
.col-side h4 { margin: 0 0 12px; padding: 0; border: 0; font-size: 18px; }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; margin: 0; font-size: 14px; }
.facts dt { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 3px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.history { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line-w); }
.history time { display: block; font: 500 11px var(--mono); color: var(--muted); }

@media print {
  header.top, .toolbar:not(:has(> h1)), .tabs, .toolbar > .btn, .comment-add { display: none; }
  body { background: #fff; }
  .prio { border: 0; background: none; padding: 0; }
}

@media (max-width: 900px) {
  header.top { grid-template-columns: 1fr auto; gap: 12px; padding: 16px; }
  .nav { grid-column: 1 / -1; order: 3; gap: 18px; overflow-x: auto; }
  main { padding: 20px 16px 48px; }
  h1, .proj-title { font-size: 44px; }
  .card-grid { grid-template-columns: 1fr; gap: 24px; }
  .filters > .search { width: 100%; }
  .map-tbl .c-opt, .dir-tbl .c-opt { display: none; }
  .tabs { display: flex; overflow-x: auto; max-width: 100%; }
  .toolbar:has(> h1) { margin-bottom: 20px; }
  .toolbar > h1 { flex-basis: 100%; padding-right: 0; margin-bottom: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .modal, .modal.wide { width: 100vw; }
  .feed li { grid-template-columns: 1fr; gap: 2px; }
  .bar { width: 100px; }
}
