:root {
  --bg: #f1f6f9;
  --card: #ffffff;
  --ink: #1f2f3a;
  --muted: #66757f;
  --line: #d9e3ea;
  --graphite: #265884;
  --accent: #0386b4;
  --accent-ink: #ffffff;
  --accent-soft: #ceedf9;
  --green: #1f8a4c;
  --green-soft: #def3e6;
  --red: #e2534f;
  --red-soft: #fbe3e1;
  --blue: #3d6f9c;
  --blue-soft: #e3eef7;
  --gray-soft: #e6edf2;
  --radius: 14px;
  --nav-h: 64px;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.2rem; margin: 0 0 8px; }
p { margin: 0 0 12px; line-height: 1.45; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Кнопки: крупные, чтобы попадать пальцем на объекте */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 12px; border: 2px solid var(--graphite);
  background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--gray-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(0.95); background: var(--accent); }
.btn.good { background: var(--green); border-color: var(--green); color: #fff; }
.btn.bad { background: var(--card); border-color: var(--red); color: var(--red); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 0.92rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tab:focus-visible, .nav a:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px;
}

/* Поля */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--line);
  border-radius: 12px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field .hint { font-weight: 400; color: var(--muted); font-size: 0.88rem; margin: 4px 0 0; }
.error { color: var(--red); background: var(--red-soft); padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }

/* Авторизация */
.auth { max-width: 460px; margin: 0 auto; padding: 32px 16px 48px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.4rem; margin-bottom: 8px; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; }
.auth-card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: 0 2px 0 var(--line); }
.auth-switch { text-align: center; margin-top: 16px; }
.link-btn { background: none; border: none; padding: 4px; color: var(--blue); text-decoration: underline; cursor: pointer; font-weight: 600; }

/* Каркас */
.shell { display: grid; grid-template-columns: 88px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--graphite); color: #fff; padding: 12px 6px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; scrollbar-width: thin; }
.side .brand { justify-content: center; margin: 4px 0 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .more-btn, .side-foot button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 2px; border-radius: 12px; color: #d9d6cf; text-decoration: none; font-weight: 600; font-size: 0.7rem; line-height: 1.1; text-align: center; min-height: 56px; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav a:hover, .more-btn:hover, .side-foot button:hover { background: rgba(255,255,255,0.09); }
.nav a.active { background: var(--accent); color: var(--accent-ink); }
.nav svg, .side-foot svg { width: 22px; height: 22px; flex: none; }
.more-btn { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-foot button { color: #a9a69f; min-height: 52px; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: var(--bg); border-bottom: 1px solid var(--line); }
.who { margin-left: auto; color: var(--muted); font-weight: 600; white-space: nowrap; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; min-height: 44px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
.search-results { position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.22); max-height: 60vh; overflow: auto; z-index: 60; padding: 6px; }
.search-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 8px 10px 2px; font-weight: 700; }
.search-item { display: block; padding: 10px; border-radius: 8px; text-decoration: none; }
.search-item:hover, .search-item:focus-visible { background: var(--accent-soft); }
.search-empty { padding: 14px; color: var(--muted); }
.main { padding: 22px 28px 48px; max-width: 1560px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

/* Карточки объектов */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: 0 2px 0 var(--line); }
a.card { display: block; text-decoration: none; }
a.card:hover { box-shadow: 0 2px 0 var(--accent); }
.card h3 { margin: 0 0 4px; font-size: 1.1rem; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.empty { text-align: center; padding: 36px 16px; background: var(--card); border-radius: var(--radius); border: 2px dashed var(--line); }
.empty .row { justify-content: center; margin-top: 12px; }

/* Бейджи */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; background: var(--gray-soft); color: var(--ink); white-space: nowrap; }
.badge.orange { background: #fdeed9; color: #8a4a00; }
.badge.green { background: var(--green-soft); color: #14693a; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

/* Вкладки и списки */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin: 16px 0; overflow-x: auto; }
.tab { padding: 12px 18px; text-decoration: none; font-weight: 700; color: var(--muted); border-bottom: 4px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.toolbar input[type="search"] { width: 100%; min-height: 48px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; }
.chip.on { background: var(--graphite); color: #fff; border-color: var(--graphite); }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; box-shadow: 0 2px 0 var(--line); }
.item.clickable { cursor: pointer; }
a.item { color: inherit; text-decoration: none; }
.notice { background: #e9f6fb; border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px; }
.item.clickable:hover { box-shadow: 0 2px 0 var(--accent); }
.item .title { font-weight: 700; }
.item .meta { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.item .side-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item select { min-height: 40px; border: 2px solid var(--line); border-radius: 10px; padding: 0 8px; background: #fff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sum { font-weight: 700; margin: 0 0 12px; }

/* Окна */
.overlay { position: fixed; inset: 0; background: rgba(20,20,22,0.55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.modal { background: var(--card); width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.close { background: var(--gray-soft); border: none; border-radius: 10px; width: 44px; height: 44px; font-size: 1.4rem; cursor: pointer; flex: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin-bottom: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.history { border-left: 3px solid var(--line); padding-left: 12px; margin: 8px 0 14px; }
.history p { margin: 0 0 8px; }
table.preview { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.preview th, table.preview td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.scroll-x { overflow-x: auto; }

/* Обучение */
.tour-dim { position: fixed; z-index: 60; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(20,20,22,0.62); pointer-events: none; transition: all .25s ease; }
.tour-card { position: fixed; z-index: 61; width: min(360px, calc(100vw - 24px)); background: #fff; border-radius: 16px; padding: 16px 18px; box-shadow: 0 10px 40px rgba(0,0,0,0.35); touch-action: pan-y; }
.tour-card h3 { margin: 0 0 6px; }
.tour-dots { display: flex; gap: 6px; margin: 10px 0; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { background: var(--accent); width: 22px; border-radius: 6px; }

/* Пакеты */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.plan { border: 3px solid transparent; }
.plan.current { border-color: var(--accent); }
.plan ul { padding-left: 20px; margin: 10px 0; line-height: 1.6; }

/* Доска */
.board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding: 4px 2px 16px; scroll-snap-type: x proximity; }
.col { flex: 0 0 272px; background: var(--gray-soft); border-radius: var(--radius); padding: 10px; scroll-snap-align: start; border-top: 4px solid var(--graphite); }
.col.won { border-top-color: var(--green); }
.col.lost { border-top-color: var(--red); }
.col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; padding: 2px 4px 6px; }
.col-count { background: #fff; border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; }
.col-meta { color: var(--muted); font-size: 0.88rem; padding: 0 4px 6px; }
.col-body { min-height: 80px; border-radius: 10px; padding: 2px; transition: background .15s; display: flex; flex-direction: column; gap: 8px; }
.col-body.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); }
.col-empty { color: var(--muted); text-align: center; padding: 18px 6px; font-size: 0.9rem; }
.kcard { background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 1px 0 var(--line); cursor: grab; }
.kcard:hover { box-shadow: 0 2px 0 var(--accent); }
.kcard.dragging { opacity: 0.45; }
.kcard .title { font-weight: 700; margin-bottom: 2px; word-break: break-word; }
.kcard .meta { color: var(--muted); font-size: 0.88rem; }
.k-sum { font-weight: 800; margin-top: 6px; }
.k-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--graphite); color: #fff; display: inline-grid; place-items: center; font-size: 0.72rem; font-weight: 700; }
.move-select { width: 100%; margin-top: 10px; min-height: 40px; border: 2px solid var(--line); border-radius: 10px; background: #fff; }
.inline-input { flex: 1; min-width: 120px; min-height: 40px; border: 2px solid var(--line); border-radius: 10px; padding: 0 10px; background: #fff; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 6px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.indent { margin-left: 32px; }
.todo.done span { text-decoration: line-through; color: var(--muted); }
.todo input[type=checkbox] { width: 22px; height: 22px; }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 16px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; padding: 0 12px; }
.toast { background: var(--graphite); color: #fff; padding: 12px 18px; border-radius: 12px; max-width: 460px; box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.toast.bad { background: var(--red); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

@media (min-width: 801px) {
  .overlay { align-items: center; padding: 20px; }
  .modal { border-radius: 20px; }
  #toasts { bottom: 24px; }
}

/* Телефон: меню снизу, всё крупно */
@media (max-width: 800px) {
  .desk-only { display: none !important; }
  .col { flex-basis: 82vw; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; z-index: 40; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); gap: 0; }
  .side .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a, .more-btn { flex: 1; padding: 6px 2px; min-height: 52px; font-size: 0.68rem; }
  .more-btn { display: flex; }
  .topbar { padding: 8px 16px; }
  .who { display: none; }
  .main { padding: 16px 16px calc(var(--nav-h) + 40px); }
  .mobile-top { display: flex; }
  .kv { grid-template-columns: 1fr; }
  .two-pane { grid-template-columns: minmax(0, 1fr); }
  .money { gap: 20px; }
  h1 { font-size: 1.4rem; }
}
.mobile-top { display: flex; }
  .kv { grid-template-columns: 1fr; }
  h1 { font-size: 1.4rem; }
}
.mobile-top { display: flex; align-items: center; padding: 10px 16px; background: var(--graphite); color: #fff; }
.mobile-top .brand { color: #fff; margin: 0; font-size: 1.15rem; }
.mobile-top button { background: transparent; border: 1px solid #55585e; color: #fff; border-radius: 10px; min-height: 40px; padding: 0 12px; }
@media (min-width: 801px) { .mobile-top { display: none !important; } }

.more-menu { display: flex; flex-direction: column; gap: 8px; }
.more-link { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 12px; text-decoration: none; background: #fff; border: 2px solid var(--line); font-weight: 600; width: 100%; cursor: pointer; font: inherit; color: inherit; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 2px 0 var(--line); text-decoration: none; display: block; }
a.kpi:hover { box-shadow: 0 2px 0 var(--accent); }
.kpi-label { color: var(--muted); font-size: 0.88rem; }
.kpi-value { font-size: 1.5rem; font-weight: 800; margin-top: 4px; }
.kpi-note { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.kpi.bad .kpi-note { color: var(--red); font-weight: 700; }
.widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.widget { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 0 var(--line); min-width: 0; }
.widget-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.widget-head h2 { margin: 0; }
.progress { height: 12px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.progress-fill.done { background: var(--green); }
.goal-line { font-size: 1.1rem; }
.funnel-mini .frow { display: grid; grid-template-columns: 130px 1fr 30px; gap: 8px; align-items: center; margin: 7px 0; }
.fname { font-size: 0.9rem; }
.fbar { display: block; height: 10px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.fbar-fill { display: block; height: 100%; background: var(--graphite); border-radius: 999px; }
.fbar-fill.won { background: var(--green); }
.fval { text-align: right; font-weight: 700; }
.money { display: flex; gap: 40px; }
.money strong { font-size: 1.3rem; }
.plus { color: var(--green); }
.feed-item { border-left: 3px solid var(--line); padding: 6px 0 6px 12px; margin: 0 0 10px; display: block; text-decoration: none; color: inherit; }
.feed-item.note { border-left-color: var(--accent); }
.feed-item.automation { border-left-color: var(--green); }
.feed-item.moved { border-left-color: var(--graphite); }
.feed-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }
.feed-text { margin-top: 2px; word-break: break-word; }
.feed.compact .feed-item { margin-bottom: 6px; }

.stagebar { list-style: none; display: flex; gap: 2px; padding: 0; margin: 0 0 16px; overflow-x: auto; }
.stagebar li { flex: 1 0 auto; }
.stagebar .step { width: 100%; border: 0; background: var(--gray-soft); padding: 0 22px; font-weight: 700; cursor: pointer; white-space: nowrap; min-height: 46px; font-family: inherit; color: var(--ink); clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.stagebar li:first-child .step { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.stagebar .step:hover { filter: brightness(0.95); }
.stagebar .step.passed { background: #cfe9d9; }
.stagebar .step.current { background: var(--accent); color: var(--accent-ink); }
.stagebar .step.won.current { background: var(--green); color: #fff; }
.stagebar .step.lost.current { background: var(--red); color: #fff; }
.two-pane { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.pane { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 0 var(--line); }
.pane-title { font-size: 1.05rem; margin: 16px 0 8px; }
.pane > .pane-title:first-child { margin-top: 0; }
.composer { background: var(--gray-soft); border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.composer-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.ctab { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--ink); min-height: 40px; }
.ctab.on { background: #fff; box-shadow: 0 1px 0 var(--line); }
.composer textarea, .composer input { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; }

.seg { display: inline-flex; background: var(--gray-soft); border-radius: 12px; padding: 3px; }
.seg-btn { border: 0; background: transparent; padding: 0 16px; min-height: 42px; border-radius: 10px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--ink); }
.seg-btn.on { background: #fff; box-shadow: 0 1px 0 var(--line); }
.toolbar select { min-height: 48px; border: 2px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; }
.quick { margin: 0 0 8px; }
.quick input { width: 100%; min-height: 42px; border: 2px dashed var(--line); border-radius: 10px; padding: 0 12px; background: #fff; }
.quick input:focus { border-color: var(--accent); border-style: solid; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: 0 2px 0 var(--line); background: #fff; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: #faf8f4; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
.th-btn { background: none; border: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; font-weight: 700; }
table.data td.num { text-align: right; white-space: nowrap; }
table.data tr.row-link { cursor: pointer; }
table.data tr.row-link:hover { background: var(--accent-soft); }
.bar-cell { width: 28%; min-width: 120px; }

/* Публичная форма заявки и страница КП */
.lead-body { background: var(--bg); margin: 0; }
.lead-card { max-width: 520px; margin: 0 auto; padding: 24px 16px 40px; }
.lead-card h1 { font-size: 1.5rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.two-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.changes { margin-top: 6px; font-size: 0.88rem; line-height: 1.5; word-break: break-word; }
.unsorted { background: #fff; border: 2px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.unsorted-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.unsorted .item { box-shadow: none; border: 1px solid var(--line); margin-top: 8px; }

/* Коммерческое предложение */
.offer-body { background: var(--bg); margin: 0; }
.offer-sheet { max-width: 820px; margin: 0 auto; padding: 24px 16px 60px; background: #fff; min-height: 100vh; }
.offer-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 3px solid var(--accent); padding-bottom: 12px; margin-bottom: 16px; }
.offer-company { text-align: right; }
.offer-block { margin: 16px 0; }
.offer-table tfoot td { border-top: 2px solid var(--graphite); font-size: 1.1rem; }
.offer-accept { background: var(--gray-soft); border-radius: var(--radius); padding: 16px; margin-top: 20px; }
.offer-accept input, .offer-accept textarea { width: 100%; margin-bottom: 8px; border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.offer-ok { color: var(--green); font-weight: 700; margin: 0; }
.pre { white-space: pre-wrap; }
@media print {
  .no-print { display: none !important; }
  .offer-body, .offer-sheet { background: #fff; padding: 0; }
  .table-wrap { box-shadow: none; }
}

.offer-edit input { width: 100%; min-height: 40px; border: 2px solid var(--line); border-radius: 8px; padding: 0 8px; background: #fff; }
.offer-edit input.narrow { max-width: 110px; }
.offer-edit input:disabled { background: transparent; border-color: transparent; }
.offer-section { margin-top: 16px; }

.queue-badge { border: 2px solid var(--accent); background: var(--accent-soft); color: #0b4f6c; font-weight: 700; border-radius: 999px; min-height: 40px; padding: 0 14px; cursor: pointer; font-family: inherit; white-space: nowrap; }
.queue-badge.bad { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.ai-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }

.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--graphite); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; }
.skip-link:focus { left: 8px; }
#view:focus { outline: none; }

.hours-input { width: 84px; text-align: center; font-size: 1.1rem; font-weight: 700; }
.worker-row.done { box-shadow: 0 2px 0 var(--good, #3a9d5d); }

/* График работ */
.gantt { display: flex; flex-direction: column; gap: 8px; }
.gantt-scale { display: flex; justify-content: space-between; font-size: 0.85rem; }
.gantt-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr; gap: 10px; align-items: center; }
.gantt-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.gantt-track { position: relative; height: 30px; background: var(--gray-soft); border-radius: 8px; }
.gantt-bar { position: absolute; top: 3px; bottom: 3px; background: var(--accent-soft); border: 2px solid var(--accent); border-radius: 6px; overflow: hidden; display: flex; align-items: center; min-width: 24px; }
.gantt-bar.done { border-color: var(--green); background: var(--green-soft); }
.gantt-bar.late { border-color: var(--red); }
.gantt-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); opacity: 0.35; }
.gantt-bar.done .gantt-fill { background: var(--green); }
.gantt-bar span { position: relative; padding: 0 6px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.gantt-today { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--red); z-index: 1; }
.shift { display: inline-flex; gap: 4px; }
.customer-link { margin-top: 16px; }
.customer-link input { flex: 1; min-width: 200px; min-height: 40px; border: 2px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; }

.struck { text-decoration: line-through; color: var(--muted); }
.is-done { opacity: 0.75; }

/* Фото и видео */
.media-group h3 { margin: 16px 0 8px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.media-item { margin: 0; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 0 var(--line); }
.media-item img, .media-item video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--gray-soft); }
.media-item figcaption { padding: 6px 8px; font-size: 0.82rem; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; align-items: center; }

.upload-form select, .upload-form input:not([type=file]) { min-height: 48px; border: 2px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; flex: 1; min-width: 160px; }
.upload-form input[type=file] { max-width: 100%; }
.upload-form input[type=file]::file-selector-button { min-height: 40px; border: 2px solid var(--graphite); border-radius: 10px; background: #fff; font-weight: 600; padding: 0 14px; margin-right: 10px; cursor: pointer; }

/* Визы */
.col-item { flex-direction: column; align-items: stretch; }
.visas { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.visa { padding: 6px 10px; border-left: 4px solid var(--line); background: var(--gray-soft); border-radius: 8px; }
.visa.active { border-left-color: var(--accent); background: var(--accent-soft); }
.visa-note { margin: 2px 0 0; }
.step-row { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.step-row input { flex: 2; min-width: 160px; }
.step-row select { flex: 1; min-width: 110px; }

/* Чат */
.chat { display: flex; flex-direction: column; gap: 8px; }
.chat-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding: 8px; background: var(--gray-soft); border-radius: var(--radius); min-height: 120px; }
.chat-msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: #fff; }
.chat-msg.mine { align-self: flex-end; background: var(--accent-soft); }
.chat-meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 2px; }
.chat-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; resize: vertical; }
.offer-block > div > input[aria-label='Ваше имя в чате'] { width: 100%; min-height: 44px; border: 2px solid var(--line); border-radius: 10px; padding: 0 12px; margin-bottom: 8px; }
/* Лента */
.feed { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feed-row { display: flex; gap: 10px; padding: 8px 10px; background: #fff; border-radius: 10px; box-shadow: 0 2px 0 var(--line); }
.feed-kind { flex: 0 0 auto; font-size: 0.74rem; font-weight: 700; color: var(--graphite); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; height: fit-content; }
.feed-meta { font-size: 0.8rem; }
.camera-block { margin-bottom: 14px; }
.check-row { display: flex; gap: 6px; align-items: center; margin: 8px 0; }

@media (max-width: 700px) {
  .tabs { scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); padding-right: 24px; }
  .tabs::-webkit-scrollbar { display: none; }
}

/* --- управление: уведомления, финансы, склад, сметы, панель --- */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; color: var(--muted); text-decoration: none; }
.bell:hover { background: var(--gray-soft); color: var(--ink); }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 0.75rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.notif.unread { border-left: 5px solid var(--accent); background: var(--accent-soft); text-decoration: none; }
a.notif { text-decoration: none; color: inherit; }
.reason { color: #8a4a00; background: #fdeed9; padding: 6px 10px; border-radius: 8px; margin: 6px 0 0; font-size: 0.92rem; }
.reason.need { color: var(--red); background: var(--red-soft); }
.alert-box { background: var(--red-soft); color: #9c2a27; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; font-weight: 600; }
.kpi.bad .kpi-value { color: var(--red); }
table.data tr.over td { background: #fff6f5; }
.remarks { margin: 6px 0 0; padding-left: 20px; }
.est-row { display: grid; grid-template-columns: 110px 1fr 80px 60px 100px 40px; gap: 6px; align-items: center; }
.est-row input, .est-row select { min-width: 0; min-height: 40px; border: 2px solid var(--line); border-radius: 10px; padding: 0 8px; background: #fff; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 14px; }
.pf-card { display: block; text-decoration: none; color: inherit; }
.pf-card.attention { border-left: 5px solid var(--red); }
.pf-card .problems { margin: 6px 0 0; padding-left: 18px; color: var(--red); font-size: 0.92rem; }
.pf-card .ok { color: var(--green); font-weight: 600; margin: 6px 0 0; }
.schedule-summary { margin: 0 0 8px; }
.gantt-tail { position: absolute; top: 50%; height: 8px; margin-top: -4px; background: repeating-linear-gradient(45deg, var(--red-soft), var(--red-soft) 4px, #fff 4px, #fff 8px); border: 1px dashed var(--red); border-radius: 4px; }
@media (max-width: 700px) {
  .est-row { grid-template-columns: 1fr 1fr; }
  .topbar .bell { margin-left: auto; }
}

.sub-banner { padding: 10px 28px; background: var(--accent-soft); color: var(--ink); font-size: 0.95rem; }
.sub-banner a { font-weight: 700; }
.sub-banner.warn { background: #fdeed9; color: #8a4a00; }
.sub-banner.bad { background: var(--red-soft); color: #9c2a27; font-weight: 600; }
@media (max-width: 700px) { .sub-banner { padding: 10px 16px; } }
.row input[type=search] { min-height: 44px; min-width: 240px; border: 2px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; }

/* --- компактное меню: значки-группы и выезжающая панель --- */
.nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 2px; border-radius: 12px; color: #d9d6cf;
  font-weight: 600; font-size: 0.7rem; line-height: 1.1; text-align: center; min-height: 56px; background: none; border: 0; cursor: pointer; font-family: inherit; width: 100%;
}
.nav button:hover, .nav button[aria-expanded="true"] { background: rgba(255,255,255,0.12); }
.nav button.active { background: var(--accent); color: var(--accent-ink); }
.nav button:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.nav button svg { width: 22px; height: 22px; flex: none; }
.nav-m { display: none; }
.flyout { display: none; position: fixed; left: 88px; top: 0; bottom: 0; width: 250px; background: #fff; box-shadow: 6px 0 24px rgba(20, 40, 60, 0.18); z-index: 35; padding: 18px 0; overflow-y: auto; }
.flyout.open { display: block; }
.flyout-title { padding: 6px 22px 14px; font-weight: 800; font-size: 0.9rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.flyout-link { display: block; padding: 14px 22px; text-decoration: none; color: var(--ink); border-top: 1px solid var(--line); font-weight: 500; }
.flyout-link:hover { background: var(--gray-soft); }
.flyout-link.active { color: var(--accent); font-weight: 700; }
.flyout-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
@media (max-width: 800px) {
  .nav-rail, .flyout { display: none !important; }
  .nav-m { display: flex; }
}

/* --- дашборд рабочего стола --- */
:root { --d1: #0386b4; --d2: #b36b00; --d3: #1f8a4c; --d4: #6f5bd1; --d5: #66757f; }
.seg { display: inline-flex; background: var(--gray-soft); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; transition: background 0.18s ease-out, color 0.18s ease-out; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 40, 60, 0.15); }
.seg button:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.dash { margin-bottom: 14px; display: grid; gap: 14px; }
.pulse { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); background: #fff; border-radius: var(--radius); box-shadow: 0 2px 0 var(--line); overflow: hidden; }
.pulse-chart { padding: 16px 18px 12px; min-width: 0; }
.pulse-foot { margin: 6px 0 0; font-size: 0.9rem; }
.pulse-stats { background: #f6fafc; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.stat-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex: 1; }
.stat-row:last-child { border-bottom: 0; }
.stat-label { color: var(--muted); font-size: 0.88rem; }
.stat-value { font-size: 1.45rem; font-weight: 800; line-height: 1.2; margin: 2px 0; }
.stat-note { font-size: 0.85rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font-weight: 700; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; white-space: nowrap; }
.delta.good { background: var(--green-soft); color: #14693a; }
.delta.bad { background: var(--red-soft); color: #b3302c; }
.delta.flat, .delta.none { background: var(--gray-soft); color: var(--muted); font-weight: 600; }
.spark { flex: none; stroke: var(--d1); }
.spark.green { stroke: var(--d3); }
.spark.amber { stroke: var(--d2); }
.bars { width: 100%; height: 200px; display: block; }
.bars .axis { stroke: var(--line); stroke-width: 1.5; }
.bars .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.bars .bar { fill: color-mix(in srgb, var(--d1) 55%, #fff); transition: fill 0.15s ease-out; }
.bars .bar.now { fill: var(--d1); }
.bars .bar:hover { fill: var(--graphite); }
.bars .tick { fill: var(--muted); font-size: 12px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { flex: none; }
.donut-track { stroke: var(--gray-soft); }
.donut-seg.d1, .dot.d1 { stroke: var(--d1); background: var(--d1); }
.donut-seg.d2, .dot.d2 { stroke: var(--d2); background: var(--d2); }
.donut-seg.d3, .dot.d3 { stroke: var(--d3); background: var(--d3); }
.donut-seg.d4, .dot.d4 { stroke: var(--d4); background: var(--d4); }
.donut-seg.d5, .dot.d5 { stroke: var(--d5); background: var(--d5); }
.donut-seg { background: none !important; }
.donut-total { font-size: 1.5rem; font-weight: 800; fill: var(--ink); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 150px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend li strong { margin-left: auto; font-size: 0.9rem; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.rank { display: grid; gap: 12px; }
.rank-row { display: grid; gap: 4px; }
.rank-top { display: flex; justify-content: space-between; gap: 10px; }
.rank-sum { font-size: 0.85rem; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 8px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--d1); border-radius: 999px; }
.rank-val { font-weight: 700; white-space: nowrap; }
.empty-small { padding: 10px 0; }
.widget.wide { grid-column: 1 / -1; }
.dash > .widget.wide { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 0 var(--line); }
.obj-list { display: grid; gap: 4px; }
.obj-row { display: block; padding: 10px 0; text-decoration: none; color: inherit; border-top: 1px solid var(--line); }
.obj-row:first-child { border-top: 0; }
.obj-row:hover .obj-title strong { color: var(--accent); }
.obj-title { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.obj-note { font-size: 0.88rem; }
.dash-skeleton { display: grid; gap: 12px; }
.dash-skeleton i { display: block; height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--gray-soft) 25%, #f1f6f9 50%, var(--gray-soft) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.dash-skeleton i:first-child { height: 230px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .dash-skeleton i { animation: none; } .seg button, .bars .bar { transition: none; } }
@media (max-width: 800px) {
  .pulse { grid-template-columns: minmax(0, 1fr); }
  .pulse-stats { border-left: 0; border-top: 1px solid var(--line); }
  .page-head .seg { width: 100%; }
  .page-head .seg button { flex: 1; }
}
