/* Fleet panel additions on top of the shared EonLink design system */


.kpi { padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-1); display: grid; gap: 4px; text-align: left; cursor: pointer; color: inherit; font: inherit; transition: border-color var(--t-fast), box-shadow var(--t-med); }
.kpi:hover { border-color: var(--border-strong); }
.kpi[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 3px var(--halo); }
.kpi .k-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.kpi .k-value { font: 500 30px/1.15 var(--mono); letter-spacing: -0.03em; }
.kpi.ok .k-label svg { color: var(--ok); }
.kpi.bad .k-label svg { color: var(--bad); }
.kpi.warn .k-label svg { color: var(--warn); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 240px; min-width: 200px; max-width: 340px; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 38px; }

/* fleet: one row per router, its trace in the middle */
.fleet-table { overflow-x: auto; }
.fleet { display: grid; min-width: 760px; }
.frow { display: grid; grid-template-columns: minmax(0, 2.2fr) 180px minmax(0, 1.4fr) 96px minmax(0, 1fr); gap: 20px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; transition: background var(--t-fast); }
.fleet .frow:first-child { border-top: 0; }
.frow:hover { background: var(--surface-2); }
.frow.fhead { min-width: 760px; border-top: 0; border-bottom: 1px solid var(--border); padding-top: 12px; padding-bottom: 12px; font-size: 12.5px; font-weight: 560; color: var(--text-3); }
.frow.fhead:hover { background: none; }
.f-name { display: grid; min-width: 0; }
.f-name b { font-weight: 600; overflow-wrap: anywhere; }
.f-name small { font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.f-name small .mono { font-size: 12.5px; }
.f-key { min-width: 0; overflow-wrap: anywhere; }
.f-lat { font-size: 14px; }
.t-bad { color: var(--bad); font-weight: 500; }
.t-warn { color: var(--warn); font-weight: 500; }

/* attention: what is broken, said plainly */
.attention { overflow: hidden; }
.att-title { margin: 0; padding: 14px 20px; font-size: 16px; font-weight: 620; letter-spacing: -0.01em; color: var(--text); border-bottom: 1px solid var(--border); }
.att-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 14px 20px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; }
.att-title + .att-row { border-top: 0; }
.att-row:hover { background: var(--surface-2); }
.att-text { flex: 1 1 320px; display: grid; min-width: 0; }
.att-text b { font-weight: 600; }
.att-text span { color: var(--text-2); }
.rcard .spark { height: 40px; }
.rcard.offline { opacity: 0.78; }

.device-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.device-head .grow { flex: 1; min-width: 200px; }
.device-head h1 { font-size: 22px; overflow-wrap: break-word; }
/* phone: the title gets the whole width, the buttons go under it in one row */
@media (max-width: 640px) {
  .device-head .grow { flex: 1 1 100%; min-width: 0; }
  .device-head > .btn { flex: 1 1 auto; }
  .device-head > .btn.icon { flex: none; }
}
.device-head .meta { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 13px; color: var(--text-3); }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; font-size: 14px; text-decoration: none; margin-bottom: 14px; min-height: 32px; }
.backlink:hover { color: var(--text); }

.steps { display: grid; gap: 18px; counter-reset: step; }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
.step::before { counter-increment: step; content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-btn); color: var(--ink-btn-text); font: 600 13px var(--mono); }
.step > div { display: grid; gap: 8px; min-width: 0; }
.cmd { display: flex; align-items: flex-start; gap: 8px; padding: 10px 10px 10px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.cmd code { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }

.ev-dev { font-weight: 650; color: var(--text); text-decoration: none; }
.ev-dev:hover { color: var(--accent); }

.userrow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.userrow:first-child { border-top: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none; text-transform: uppercase; }

/* fleet pulse, map, management */
.pulse { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .pulse { grid-template-columns: 1.1fr 1fr; align-items: center; } }
.pulse-big { font: 500 44px/1 var(--mono); letter-spacing: -0.04em; }
.pulse-big small { font-size: 15px; color: var(--text-3); font-weight: 600; margin-left: 4px; }
.pulse-days { display: flex; gap: 6px; align-items: flex-end; height: 64px; }
.pulse-days .pd { flex: 1; border-radius: 6px; background: var(--ok); min-height: 6px; position: relative; }
.pulse-days .pd.warn { background: var(--warn); } .pulse-days .pd.bad { background: var(--bad); } .pulse-days .pd.none { background: var(--surface-3); }
.pulse-days .pd span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-3); }
.view-toggle { margin-left: auto; }
.map { height: min(62vh, 560px); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.map .leaflet-popup-content { font: 13px/1.5 var(--font); }
.map-pin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.map-pin.ok { background: #22a25c; } .map-pin.warn { background: #F0B44C; } .map-pin.bad { background: #c8303a; } .map-pin.idle { background: #6b7383; }
.gchips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.gchip { font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.health-mini { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width var(--t-slow) var(--ease-out); }
.ro-log { font: 12.5px/1.6 var(--mono); color: var(--text-2); max-height: 220px; overflow: auto; background: var(--surface-2); border-radius: var(--r-md); padding: 10px 14px; }
.map.map-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9) saturate(0.6); }

/* ---------- updates ---------- */
.ver-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.ver-tile { display: grid; gap: 8px; align-content: start; }
.ver-tile .k-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.ver-tile .ver-num { font: 500 30px/1.1 var(--mono); letter-spacing: -0.02em; }
.ver-tile .btn { justify-self: start; }
.dropzone { display: grid; justify-items: center; gap: 6px; padding: 28px 18px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--text); background: var(--fiber-soft); outline: none; }
.dropzone.busy { pointer-events: none; }
.dropzone .dz-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1); }
.dropzone .dz-title { font-weight: 600; }
.dropzone .dz-progress { width: min(320px, 100%); margin-top: 6px; }
.rel-item .title .pill { margin-left: 4px; vertical-align: 1px; }
.rel-notes { margin-top: 8px; }
.rel-notes summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); width: max-content; }
.rel-notes > div { margin-top: 6px; display: grid; gap: 4px; color: var(--text-2); }
.note-li { position: relative; padding-left: 14px; }
.note-li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.ver-jump { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.ver-jump .mono { font-weight: 700; }
.steps-mini { display: grid; gap: 6px; font-size: 14px; }
.steps-mini > div { display: flex; gap: 8px; align-items: flex-start; }
.steps-mini svg { color: var(--ok); margin-top: 3px; flex: none; }
.ver-jump .spin { animation: spin 0.9s linear infinite; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .ver-jump .spin { animation: none; } }

/* ---------- support tickets ---------- */
.tk-row { color: inherit; text-decoration: none; }
.tk-row:hover { background: var(--surface-2); }
.tk-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.tk-ic.warn { background: var(--warn-soft); color: var(--warn); }
.tk-ic.bad { background: var(--bad-soft); color: var(--bad); }
.tk-quote { font-size: 16px; line-height: 1.5; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.chk-grid { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.chk-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-3); padding: 6px 8px 6px 0; }
.tbl td { padding: 6px 8px 6px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.tk-pre summary { cursor: pointer; }
.tk-pre pre { margin: 12px 0 0; max-height: 420px; overflow: auto; font: 12px/1.55 var(--mono); background: var(--surface-2); padding: 12px; border-radius: var(--r-md); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- journal ---------- */
.audit { display: grid; }
.au-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 14px; }
.au-row:first-child { border-top: 0; }
.au-row .grow { min-width: 0; overflow-wrap: anywhere; }
.au-ic { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.au-ic.router { background: var(--idle-soft); color: var(--idle); }
.au-ic svg.i { width: 15px; height: 15px; }
.au-detail { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.au-row .ev-time { flex: none; font-size: 12px; color: var(--text-3); white-space: nowrap; }
@media (max-width: 640px) { .au-row { flex-wrap: wrap; } .au-row .ev-time { width: 100%; padding-left: 40px; } }

/* ---------- security & login ---------- */
.tf-qr { display: grid; place-items: center; }
.tf-qr svg { width: min(220px, 70vw); height: auto; background: #fff; padding: 8px; border-radius: var(--r-md); }
.rec-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-size: 15px; }
.rec-codes span { padding: 8px 10px; background: var(--surface-2); border-radius: var(--r-sm); text-align: center; }
.or-sep { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- client cabinet ---------- */
.cab-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.cab-card h2 { margin-bottom: 6px; }
.cab-card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.cab-ic { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--idle-soft); color: var(--idle); }
.cab-ic.ok { background: var(--ok-soft); color: var(--ok); }
.cab-ic.warn { background: var(--warn-soft); color: var(--warn); }
.cab-ic.bad { background: var(--bad-soft); color: var(--bad); }

/* subscriptions table */
.subs-list { display: grid; min-width: 720px; }
.srow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 0.8fr) 200px; gap: 20px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); }
.subs-list .srow:first-child { border-top: 0; }
.srow.fhead { min-width: 720px; border-top: 0; border-bottom: 1px solid var(--border); padding-top: 12px; padding-bottom: 12px; font-size: 12.5px; font-weight: 560; color: var(--text-3); }
.srow .f-name a { color: inherit; text-decoration: none; }
.srow .f-name a:hover { text-decoration: underline; }
.srow .actions { justify-content: flex-end; }

/* 1.6: what works at which provider */
.table-wrap { overflow-x: auto; }
.isp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.isp-table th, .isp-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.isp-table thead th { font-size: 12.5px; font-weight: 560; color: var(--text-3); }
.isp-table tbody th { text-align: left; font-weight: 400; }
.isp-table tbody th b { display: block; font-weight: 600; }
.isp-table tbody th small { font-size: 12px; }
.isp-table tr:last-child th, .isp-table tr:last-child td { border-bottom: 0; }
.isp-c.ok b { color: var(--text); }
.isp-c.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.isp-c.warn b { color: var(--warn); }
.isp-c.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.isp-c.bad b { color: var(--bad); }
.isp-c.none { color: var(--text-3); }

/* QR scanner from the router sticker */
.qr-cam { width: 100%; min-height: 240px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.qr-cam video { width: 100% !important; height: auto !important; display: block; }

/* 1.6.1: problems inbox */
.att-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.att-head .att-title { padding: 0; border: 0; }
.attention > p { padding: 0 20px 14px !important; }
.att-row.issue { border-top: 1px solid var(--border); }
.att-head + .att-row { border-top: 0; }
.att-row.issue:hover { background: none; }
.att-row.issue.bad .att-text b a { color: var(--text); }
.att-text b a { color: inherit; text-decoration: none; }
.att-text b a:hover { text-decoration: underline; }
.att-text small { font-size: 12.5px; margin-top: 2px; }
.att-row.issue::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.att-row.issue.bad::before { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.att-row.issue.warn::before { background: var(--fiber); box-shadow: 0 0 0 3px var(--fiber-soft); }

/* 1.8 polish: the fleet and subscription tables become cards on narrow screens (no sideways scroll) */
.frow { transition: background-color var(--t-fast) var(--ease-out); }
.frow:active { background: var(--surface-2); }
@media (hover: none) { .frow:hover { background: none; } }
@media (max-width: 900px) {
  .fleet { min-width: 0; }
  .fleet-table { overflow: visible; }
  .frow.fhead, .srow.fhead { display: none; }
  .frow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name lat" "trace trace" "key sub"; gap: 10px 16px; padding: 16px; }
  .frow .f-name { grid-area: name; }
  .frow .f-lat { grid-area: lat; justify-self: end; align-self: start; }
  .frow .f-trace { grid-area: trace; }
  .frow .f-trace .trace-mini { width: 100%; }
  .frow .f-key { grid-area: key; font-size: 14px; }
  .frow .f-sub { grid-area: sub; justify-self: end; text-align: right; font-size: 13.5px; }
  .subs-list { min-width: 0; }
  .srow { min-width: 0; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "term plan" "acts acts"; gap: 8px 16px; padding: 16px; }
  .srow > :nth-child(1) { grid-area: name; }
  .srow > :nth-child(2) { grid-area: term; }
  .srow > :nth-child(3) { grid-area: plan; justify-self: end; }
  .srow > :nth-child(4) { grid-area: acts; justify-content: flex-start; }
}
/* problems inbox: actions stay on one line, the stripe tells the severity */
.att-row.issue { transition: background-color var(--t-fast); }
.att-head .chips .chip { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
@media (max-width: 640px) {
  .att-row.issue > .row, .att-row.issue > .btn { width: 100%; justify-content: flex-end; }
}
/* pulse: days as quiet bars, the bad ones stand out */
.pulse-days .pd { transition: transform var(--t-med) var(--ease-out); transform-origin: bottom; }
/* calm by default: a good day is graphite, only a bad day takes colour */
.pulse-days { height: 56px; gap: 8px; padding-bottom: 20px; box-sizing: content-box; }
.pulse-days .pd { border-radius: 4px; background: color-mix(in srgb, var(--text) 72%, transparent); }
.pulse-days .pd.none { background: var(--surface-3); }


/* ---------- «Трасса 2.0»: panel ---------- */
.att-row { transition: background-color var(--t-fast); }
.att-row.issue { gap: 12px 16px; animation: fadeup 320ms var(--ease-out) both; }
.att-row.issue:nth-child(3) { animation-delay: 40ms; } .att-row.issue:nth-child(4) { animation-delay: 80ms; } .att-row.issue:nth-child(n + 5) { animation-delay: 120ms; }
.frow .f-lat { font-family: var(--mono); font-size: 14px; }
.f-name b { font-weight: 620; }
.pulse-days .pd { animation: grow 520ms var(--ease-out) both; }
.pulse-days .pd:nth-child(2) { animation-delay: 30ms; } .pulse-days .pd:nth-child(3) { animation-delay: 60ms; } .pulse-days .pd:nth-child(4) { animation-delay: 90ms; }
.pulse-days .pd:nth-child(5) { animation-delay: 120ms; } .pulse-days .pd:nth-child(6) { animation-delay: 150ms; } .pulse-days .pd:nth-child(n + 7) { animation-delay: 180ms; }
.pulse-days .pd.bad { background: var(--bad); } .pulse-days .pd.warn { background: var(--fiber); }
.avatar { background: var(--surface-3); color: var(--text); }
.gchip { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.progress span { background: var(--text); }
.note-li::before { background: var(--text-3); }
.rel-notes summary { color: var(--text); }
.au-ic { background: var(--surface-2); color: var(--text-2); }
.ev-dev:hover { color: var(--text); text-decoration: underline; }
.isp-c.warn { background: var(--fiber-soft); }
.isp-c.warn b { color: var(--fiber-ink); }

/* «Доступы»: a user row keeps the role picker on its own line on a phone */
.acc-urow { flex-wrap: wrap; }
.acc-who { flex: 1 1 160px; min-width: 0; }
.acc-ctl { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.acc-ctl .select { width: 168px; }
@media (max-width: 560px) {
  .acc-ctl { flex: 1 1 100%; padding-left: 48px; }
  .acc-ctl .select { flex: 1 1 auto; width: auto; }
}

/* Рассылки: the form and a live preview beside it */
.bc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.bc-side { position: sticky; top: 16px; }
.bc-preview { background: var(--surface-2, var(--bg)); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; min-height: 80px; }
.bc-pick { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px 12px; }
.bc-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--text); font-family: var(--mono, ui-monospace, monospace); text-decoration: underline dotted; cursor: pointer; }
@media (max-width: 900px) { .bc-grid { grid-template-columns: 1fr; } .bc-side { position: static; } }
/* OpenWrt update */
.kv-list { display: grid; gap: 6px; }
.kv-list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv-list span { color: var(--text-3); }
.kv-list b { text-align: right; overflow-wrap: anywhere; }
.fw-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.fw-bar i { display: block; height: 100%; width: 30%; background: var(--fiber); border-radius: 3px; animation: fw-run 1.4s cubic-bezier(.65, 0, .35, 1) infinite; }
@keyframes fw-run { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .fw-bar i { animation: none; width: 100%; opacity: .5; } }

/* Обращения: a conversation */
.tk-chat { overflow: hidden; }
.tk-msgs { display: flex; flex-direction: column; gap: 12px; padding: 18px; max-height: min(62vh, 720px); overflow-y: auto; overscroll-behavior: contain; }
.tk-msg { display: flex; flex-direction: column; max-width: min(78%, 620px); gap: 4px; }
.tk-msg.in { align-self: flex-start; }
.tk-msg.out { align-self: flex-end; align-items: flex-end; }
.tk-bub { padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); line-height: 1.5; overflow-wrap: anywhere; }
.tk-msg.in .tk-bub { border-bottom-left-radius: 6px; }
.tk-msg.out .tk-bub { background: var(--ink-btn); color: var(--ink-btn-text); border-color: transparent; border-bottom-right-radius: 6px; }
.tk-msg.note .tk-bub { background: var(--fiber-soft); color: var(--fiber-ink); border: 1px dashed var(--fiber); }
.tk-text { white-space: pre-wrap; }
.tk-tag { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.tk-meta { font-size: 12px; color: var(--text-3); padding: 0 4px; }
.tk-sys { align-self: center; font-size: 12px; color: var(--text-3); text-align: center; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tk-find.bad { color: var(--bad); } .tk-find.warn { color: var(--fiber-ink); }
.tk-img { display: block; max-width: 260px; max-height: 260px; border-radius: 10px; margin-top: 6px; }
.tk-file { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; color: inherit; }
.tk-comp { border-top: 1px solid var(--border); padding: 14px 18px; display: grid; gap: 10px; }
.tk-comp.noting textarea { border-color: var(--fiber); background: var(--fiber-soft); }
.tk-tpl { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tk-tpl .chip { white-space: nowrap; flex: none; }
.tk-act { gap: 10px; }
.tk-diag > summary { cursor: pointer; font-weight: 700; font-size: 18px; list-style: none; }
@media (max-width: 640px) { .tk-msg { max-width: 92%; } .tk-msgs { padding: 14px; } .tk-comp { padding: 12px 14px; } }
/* Клиенты */
.cl-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.cl-note { border-left: 3px solid var(--border); padding: 4px 0 4px 12px; }
.cl-note .meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--text-3); margin-top: 4px; }
@media (max-width: 900px) { .cl-grid { grid-template-columns: 1fr; } }
.page-head p a svg.i { vertical-align: -3px; margin-right: 3px; }
/* Задачи */
/* requests from the site */
.lead-row { cursor: pointer; }
.lead-row .meta span { display: inline-flex; align-items: center; gap: 4px; }
.lead-row:has(.pill.accent) { box-shadow: inset 3px 0 0 var(--fiber); }
.lead-comment { margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.chip-n { font-variant-numeric: tabular-nums; color: var(--text-3); font-weight: 600; margin-left: 2px; }
.chip[aria-pressed="true"] .chip-n { color: inherit; opacity: .75; }
.prose-box { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, rgba(127,127,127,.08)); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.task-row { cursor: pointer; }
.task-row .title { display: flex; align-items: center; gap: 6px; }
.task-row .meta span { display: inline-flex; align-items: center; gap: 4px; }
.task-row.overdue { box-shadow: inset 3px 0 0 var(--bad); }
.task-check { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong, var(--text-3)); background: none; display: grid; place-items: center; color: var(--ink-btn-text); cursor: pointer; transition: transform 160ms cubic-bezier(.23, 1, .32, 1), background-color 160ms; }
.task-check:active { transform: scale(.9); }
.task-check[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.task-row:has(.task-check[aria-pressed="true"]) .title { text-decoration: line-through; color: var(--text-3); }
/* Финансы */
.fn-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .fn-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .fn-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.fn-kpi { display: grid; gap: 4px; }
.fn-num { font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.fn-num small { font-size: 14px; color: var(--text-3); font-weight: 500; }
.fn-bars .bar-col { position: relative; }
.fn-bar-v { color: var(--text-3); text-align: center; }
.tbl-wrap { overflow-x: auto; }
.fn-tbl td, .fn-tbl th { white-space: nowrap; }
.ts-bar { gap: 10px 28px; }

/* Финансы: деньги и клиенты двумя рядами, выручка рядом с расходами по месяцам */
.fn-money { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fn-people { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1180px) { .fn-money { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .fn-people { grid-template-columns: 1fr; } }
.t-ok { color: var(--ok); }
.fn-chart { display: flex; gap: 10px; align-items: stretch; height: 200px; }
.fn-m { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fn-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.fn-pair i { width: min(16px, 40%); border-radius: 4px 4px 0 0; min-height: 2px; transform-origin: bottom; animation: fn-grow 520ms cubic-bezier(.23, 1, .32, 1) both; }
i.fn-rev { background: var(--fiber); }
i.fn-exp { background: color-mix(in srgb, var(--bad) 70%, var(--surface)); }
.legend i.fn-rev, .legend i.fn-exp { display: inline-block; width: 10px; height: 10px; border-radius: 3px; animation: none; }
.fn-p { color: var(--text-2); }
@keyframes fn-grow { from { transform: scaleY(0); } }
@media (prefers-reduced-motion: reduce) { .fn-pair i { animation: none; } }
.fn-cats { display: grid; gap: 8px; }
.fn-cat { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 14px; }
.fn-cat i { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--bad) 70%, var(--surface)); }
.fn-erow { cursor: pointer; }
.fn-erow:hover { background: var(--surface-2); }

/* text people type (names, notes, links, addresses) wraps instead of pushing the page wider */
.cl-note, .cl-note > div, .kv-list b, .list-item .title, .list-item .meta span, .tk-quote, .bc-text, .event .ev-msg, .page-head h1, .page-head p { overflow-wrap: break-word; min-width: 0; }
.list-item > .grow { min-width: 0; }
.nowrap { white-space: nowrap; }
.frow .f-sub, .srow > :nth-child(2) { overflow-wrap: normal; }
/* phone: the search takes the whole line instead of floating after the filter chips */
@media (max-width: 640px) {
  .toolbar .spacer { display: none; }
  .toolbar .search { max-width: none; flex: 1 1 100%; min-width: 0; }
}
.kv-list > div > span { flex: none; }
.kv-list > div > b { flex: 1 1 auto; min-width: 0; }
/* phone: a long value (an address, an e-mail) goes under its label instead of squeezing beside it */
@media (max-width: 640px) {
  .kv-list > div { flex-direction: column; gap: 2px; }
  .kv-list > div > b { text-align: left; }
}
.kv-list { grid-template-columns: minmax(0, 1fr); }
.kv-list > div > b { overflow-wrap: anywhere; }
/* cabinet: the router's actions in even pairs on a phone */
@media (max-width: 640px) {
  .cab-card > .row.wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cab-card > .row.wrap > .btn { width: 100%; }
  .cab-card > .row.wrap > .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
