/* Поток — демо-приложение arweiss */

@font-face { font-family: "Onest"; src: url("fonts/onest-cyrillic.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; src: url("fonts/onest-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }

:root {
  --bg: #0e0f11;
  --panel: #17191d;
  --panel-2: #1f2227;
  --line: #2a2e35;
  --line-strong: #5a616d;
  --text: #f2f3f5;
  --muted: #a3a9b4;
  --accent: #c5f04a;
  --accent-ink: #0e0f11;
  --new: #7db4ff;
  --work: #ffc861;
  --done: #6fe0a0;
  --lost: #ff9a9a;
  --radius: 18px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 .9375rem/1.5 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

h1 { font-size: clamp(1.625rem, 3vw, 2rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: .875rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.noscript { margin: 16px; padding: 14px 16px; border: 1px solid currentColor; border-radius: 12px; }
.demo-bar { background: var(--panel-2); color: var(--muted); text-align: center; font-size: .8125rem; padding: 7px 16px; border-bottom: 1px solid var(--line); }

.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 34px); }

.side { display: flex; flex-direction: column; gap: 28px; padding: 24px 16px; border-right: 1px solid var(--line); position: sticky; top: 0; height: calc(100vh - 34px); min-height: 320px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 1.25rem; font-weight: 600; letter-spacing: -.03em; text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.menu { display: grid; gap: 4px; }
.menu a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--muted); text-decoration: none; transition: background-color .15s, color .15s; }
.menu a svg { width: 18px; height: 18px; }
.menu a:hover { background: var(--panel); color: var(--text); }
.menu a[aria-current="page"] { background: var(--panel-2); color: var(--text); }
.side__reset { margin-top: auto; align-self: flex-start; }

.link-btn { background: none; border: 0; padding: 10px 8px; color: var(--muted); font-size: .875rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--text); }

.main { padding: clamp(20px, 3vw, 36px); max-width: 1180px; width: 100%; }
.main > section { display: grid; gap: 16px; }
.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: 12px; background: transparent; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.btn:hover { background: var(--panel-2); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { background: #d5fa6c; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi__label { color: var(--muted); font-size: .875rem; }
.kpi__value { margin-top: 10px; font-size: clamp(1.5rem, 2.4vw, 1.875rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__note { margin-top: 6px; color: var(--muted); font-size: .8125rem; }
.kpi__note.up { color: var(--done); }
.kpi__note.down { color: var(--lost); }

.grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.chart { margin-top: 16px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .bar { fill: var(--accent); }
.chart .bar--zero { fill: var(--line); }
.chart text { fill: var(--muted); font-size: 15px; font-family: inherit; }
.chart .val { fill: var(--text); font-weight: 500; }
.chart .axis { stroke: var(--line); }

.bars { display: grid; gap: 16px; margin-top: 20px; }
.bars__row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.bars__track { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.bars__fill { height: 100%; border-radius: 4px; background: var(--c); }

.status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
[data-status="new"] { --c: var(--new); }
[data-status="work"] { --c: var(--work); }
[data-status="done"] { --c: var(--done); }
[data-status="lost"] { --c: var(--lost); }

.recent { margin-top: 8px; }
.recent li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.recent li:first-child { border-top: 0; }
.recent strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent small { display: block; color: var(--muted); font-size: .8125rem; }

.tools { display: flex; flex-wrap: wrap; gap: 12px; }
.field--search { flex: 1 1 240px; }
.field label:not(.sr) { display: block; margin-bottom: 6px; font-size: .875rem; font-weight: 500; }
.field input, .field select, td select {
  width: 100%; min-height: 44px; padding: 0 14px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px;
}
.field input::placeholder { color: #8e95a1; opacity: 1; }
.field input:hover, .field select:hover, td select:hover { border-color: #8a92a0; }
.field [aria-invalid="true"] { border-color: var(--lost); }
.err { margin-top: 6px; color: var(--lost); font-size: .8125rem; }

.panel--table { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num, td.num { text-align: right; }
th { color: var(--muted); font-size: .8125rem; font-weight: 500; }
th button { background: none; border: 0; padding: 6px 0; color: inherit; font-weight: inherit; cursor: pointer; }
th button::after { content: " ↕"; opacity: .5; }
th[aria-sort="ascending"] button, th[aria-sort="descending"] button { color: var(--text); }
th[aria-sort="ascending"] button::after { content: " ↑"; opacity: 1; }
th[aria-sort="descending"] button::after { content: " ↓"; opacity: 1; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #1b1e22; }
td.id { color: var(--muted); font-variant-numeric: tabular-nums; }
td.client { font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
td .cell-status { display: flex; align-items: center; gap: 10px; }
td .cell-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
td select { width: auto; min-height: 36px; padding: 0 10px; background: var(--panel-2); border-color: var(--line); border-radius: 10px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

dialog { width: min(440px, calc(100vw - 32px)); padding: 24px; background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog form { display: grid; gap: 16px; }
dialog h2 { font-size: 1.25rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: calc(100vw - 32px); padding: 12px 18px; background: var(--text); color: var(--bg); border-radius: 12px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand span { display: none; }
  .menu { display: flex; flex: 1; }
  .side__reset { margin: 0; align-self: center; }
  .recent li { grid-template-columns: minmax(0, 1fr) auto; }
  .recent li > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .recent li > :nth-child(3) { grid-row: 1 / span 2; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
  .top .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
