/* Оформление в духе веб-интерфейса ПланФикса: тёмное меню слева, список задач, открытая карточка справа с лентой.
   Без сборки — обычный CSS. На телефоне: список → карточка, внизу панель вкладок, кнопки не мельче 44px. */
:root {
  --bg: #f4f6f9; --panel: #fff; --ink: #1f2933; --muted: #6b7686; --line: #e3e7ed; --soft: #f7f9fb;
  --side: #233142; --side-ink: #c3cddb; --side-on: #31445c; --accent: #2f80ed; --accent-ink: #fff;
  --err: #c0392b; --ok: #1f9d55; --warn: #e67e22; --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 20px; margin: 0 0 8px; }
h2 { font-size: 15px; margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .btn { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 7px 12px;
  min-height: 36px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); justify-content: center; }
button:hover, .btn:hover { border-color: #c9d1dc; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.sm, button.sm { min-height: 30px; padding: 3px 9px; font-size: 13px; }
button:disabled { opacity: .5; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #fff; min-height: 36px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe0fb; border-color: var(--accent); }
.err { background: #fdecea; color: var(--err); padding: 8px 10px; border-radius: 6px; }
.note { background: #fff7e6; color: #8a5a00; padding: 8px 10px; border-radius: 6px; }
.hint, .muted { color: var(--muted); }
.ic { flex: none; }
.lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
.ava { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #dbe7fb;
  color: #2b5aa6; font-size: 12px; font-weight: 700; flex: none; }
.ava.sm { width: 22px; height: 22px; font-size: 10px; margin-right: 5px; vertical-align: middle; }
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 14px;
  padding: 2px 9px 2px 3px; margin: 2px 4px 2px 0; background: var(--soft); }
label.pill { padding: 3px 10px; cursor: pointer; }
.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); }

/* ---------- каркас: меню слева, шапка, содержимое ---------- */
body.app { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 14px; color: #fff; font-weight: 700; }
.side .logo span, .auth-logo span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent); color: #fff; font-weight: 800; }
.side .logo b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.side nav { display: flex; flex-direction: column; padding: 6px 8px; gap: 2px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 9px 10px; border-radius: 6px; position: relative; }
.side nav a:hover { background: #2b3b50; color: #fff; }
.side nav a.on { background: var(--side-on); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.cnt { background: #e74c3c; color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; line-height: 17px; margin-left: auto; }
.cnt:empty { display: none; }
.side .me { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid #31445c; }
.side .me a { color: var(--side-ink); display: flex; }
.me-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; color: #fff; overflow: hidden; }
.me-name small { color: var(--side-ink); }
.wrap { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 16px;
  height: 56px; position: sticky; top: 0; z-index: 5; }
.gsearch { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 6px; background: var(--soft);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; color: var(--muted); }
.gsearch input { border: 0; background: transparent; padding-left: 0; }
.gsearch input:focus { outline: none; }
.presence { display: flex; gap: 6px; }
.tog { white-space: nowrap; background: #fff; color: var(--muted); border-color: var(--line); padding: 4px 11px; min-height: 34px; border-radius: 17px; }
.tog i { width: 8px; height: 8px; border-radius: 50%; background: #c3cad4; }
.tog.on { color: var(--ok); border-color: #a6dcbc; background: #eefaf2; }
.tog.on i { background: var(--ok); }
.top .new { margin-left: auto; }
.tabbar { display: none; }

/* ---------- список и карточка ---------- */
.split { display: grid; grid-template-columns: 400px minmax(0, 1fr); height: calc(100vh - 56px); }
.list { border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; display: flex; flex-direction: column; }
.list > * { flex-shrink: 0; }
.vtabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.vtabs a { padding: 8px 10px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.vtabs a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 4px; }
.filters > * { flex: 1 1 140px; }
.list-head { display: flex; align-items: center; gap: 8px; padding: 6px 12px; }
.list-head small { color: var(--muted); }
.list-head .tools { margin-left: auto; display: flex; gap: 6px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows a { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "num title chip" "meta meta meta";
  gap: 2px 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.rows a:hover, .rows li.cur a { background: #eef4fe; }
.rows .num { grid-area: num; color: var(--muted); }
.rows .title { grid-area: title; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .chip { grid-area: chip; align-self: start; }
.rows .meta { grid-area: meta; font-size: 12px; color: var(--muted); }
.late { color: var(--err); }
.rows .empty { padding: 20px 12px; color: var(--muted); }
.more { display: block; text-align: center; padding: 12px; }
.panel { overflow-y: auto; padding: 16px 22px 40px; }
.empty-panel { margin-top: 30vh; text-align: center; }

.card .back { display: none; align-items: center; gap: 4px; margin-bottom: 8px; }
.card-head { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.crumbs { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-btn { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 14px; border-radius: 16px; color: #fff; background: var(--c); font-weight: 600; }
.accept { min-width: 160px; min-height: 44px; font-size: 15px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; }
.people .pr { display: flex; gap: 10px; align-items: center; padding: 4px 0; flex-wrap: wrap; }
.people .pr .lbl { width: 110px; flex: none; }
.people .pr.inline select { width: auto; flex: 1 1 180px; max-width: 280px; }
.pr-edit summary { cursor: pointer; color: var(--accent); margin: 4px 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.statusbox summary { font-weight: 600; cursor: pointer; }
.statuses { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.st-opt input { display: none; }
.st-opt span { display: inline-block; padding: 6px 12px; border: 1px solid var(--c); color: var(--c); border-radius: 16px; cursor: pointer; }
.st-opt input:checked + span { background: var(--c); color: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid2 .wide { grid-column: 1 / -1; }
.fld { display: block; margin: 6px 0; color: var(--muted); font-size: 13px; }
.fld input, .fld select, .fld textarea { margin-top: 3px; color: var(--ink); font-size: 14px; }
.fld .check { display: flex; align-items: center; gap: 6px; min-height: 36px; color: var(--ink); }
.fld .check input { width: 20px; height: 20px; }
.phone-row { display: flex; gap: 6px; align-items: center; }
.phone-row input { flex: 1; }
.fields > button { margin-top: 6px; }
dl.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 12px; margin: 10px 0 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

.feed > ul { list-style: none; padding: 0; margin: 0 0 12px; }
.ev { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ev-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ev-head { display: flex; gap: 8px; align-items: baseline; }
.ev .when { color: var(--muted); font-size: 12px; margin-right: 6px; }
.ev-comment .txt { margin-top: 2px; }
.ev-comment .txt ul, .ev-comment .txt ol { margin: 4px 0; padding-left: 20px; }
.ev .to { color: var(--muted); font-size: 12px; margin-top: 3px; }
.ev:not(.ev-comment) { color: #7a8594; font-size: 13px; background: var(--soft); border-radius: 6px; padding: 6px 10px; margin: 4px 0; border: 0; }
.ev:not(.ev-comment) .who { color: #56606d; }
.digest { margin-top: 8px; background: #fff; border: 1px solid #f0d9a8; border-radius: 6px; padding: 8px 10px; color: var(--ink); font-size: 14px; }
.dg { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 4px 0; }
.dg .lbl { width: 100%; }
.dg .txt { width: 100%; }
.composer { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; }
.toolbar button { min-height: 32px; min-width: 34px; padding: 2px 8px; }
.toolbar .emoji { display: flex; flex-wrap: wrap; gap: 2px; }
.toolbar .emoji button { border-color: transparent; background: transparent; padding: 0 4px; min-width: 30px; }
.recips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.recips .lbl { margin-right: 4px; }
.composer > button { align-self: flex-start; }

/* ---------- страницы-листы ---------- */
.sheet { max-width: 900px; margin: 20px auto; background: var(--panel); padding: 20px; border-radius: 10px; border: 1px solid var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.notif { list-style: none; padding: 0; margin: 0; }
.notif a { display: flex; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notif li.new a { background: #eef4fe; font-weight: 600; }
.notif .when { color: var(--muted); white-space: nowrap; font-weight: 400; }
.notif .empty { padding: 20px 6px; color: var(--muted); }
.menu a { display: flex; align-items: center; gap: 12px; padding: 14px 6px; border-bottom: 1px solid var(--line); color: var(--ink); }
.adduser { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 6px; margin-bottom: 14px; }
.ulist { border-top: 1px solid var(--line); }
.urow { border-bottom: 1px solid var(--line); }
.urow summary { display: flex; align-items: center; gap: 10px; padding: 10px 4px; cursor: pointer; list-style: none; }
.urow summary::-webkit-details-marker { display: none; }
.urow .un { display: flex; flex-direction: column; }
.urow .un small { color: var(--muted); }
.urow.off { opacity: .55; }
.profile { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; padding: 0 4px 10px 44px; }
.profile .fld:nth-child(3), .profile button { grid-column: 1 / -1; justify-self: start; }
.uact { display: flex; gap: 8px; padding: 0 4px 12px 44px; }
.linkbox { background: #eef4ff; padding: 10px; border-radius: 6px; margin-bottom: 12px; }
.linkbox input { margin-top: 6px; }
.newcard .grid2 { margin-bottom: 12px; }

body.guest { background: var(--side); }
.auth { max-width: 360px; margin: 12vh auto; background: var(--panel); padding: 24px; border-radius: 12px; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-bottom: 14px; }
.auth label { display: block; margin: 10px 0; color: var(--muted); }
.auth button { width: 100%; margin-top: 8px; min-height: 44px; }

/* ---------- фильтры, сохранённые фильтры ---------- */
.saved { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.sf { display: inline-flex; align-items: center; border: 1px solid #cfe0fb; background: #eef4fe; border-radius: 14px; padding-left: 10px; }
.sf form { display: inline; }
.sf button { border: 0; background: transparent; min-height: 28px; padding: 0 8px; color: var(--muted); }
.fpanel { flex: 1 1 100%; }
.fpanel summary { cursor: pointer; color: var(--accent); padding: 4px 0; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.fbtns { display: flex; gap: 6px; margin: 6px 0; }
.savef { display: flex; gap: 6px; padding: 0 12px 6px; }
.savef input { flex: 1; }
.attach { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.attach input { flex: 1 1 200px; border-style: dashed; }
.file { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.file img { display: block; max-width: 220px; max-height: 160px; border-radius: 6px; border: 1px solid var(--line); }
.file > a:first-child:has(img) { flex-basis: 100%; }

/* ---------- кабинет, таблицы, настройки ---------- */
.sheet.wide { max-width: 1180px; }
.tscroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; margin: 6px 0 16px; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: middle; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--soft); }
table.grid td.n { text-align: center; font-variant-numeric: tabular-nums; }
table.grid td.c { text-align: center; }
table.grid td.sm { width: 90px; }
table.grid tr.off td { opacity: .55; }
table.grid a.zero { color: #b8c0cc; }
.bad { color: var(--err); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c3cad4; margin-right: 6px; }
.dot.ok { background: var(--ok); } .dot.on { background: var(--accent); }
.pres { white-space: nowrap; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.tot { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tot .nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tot .nums a { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 6px; background: var(--soft); color: var(--ink); }
.tot .nums a:hover { background: #eef4fe; }
.tot .nums b { font-size: 22px; }
.tot .nums span { font-size: 12px; color: var(--muted); }
.waitlist, .nowlist { list-style: none; padding: 0; margin: 0 0 10px; }
.waitlist li, .nowlist li { padding: 6px 0; border-bottom: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg a { padding: 6px 12px; color: var(--muted); }
.seg a.on { background: var(--accent); color: #fff; }
.settings .vtabs { padding: 0; margin-bottom: 12px; }
.tgbox { background: #eef4fe; border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.qgrid { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 14px; }
.queue { margin: 4px 0 0; padding-left: 20px; }
.queue li.muted { list-style: none; margin-left: -20px; }
.big { font-size: 28px; font-weight: 700; }
.big-check { font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.okmsg { background: #eefaf2; color: var(--ok); padding: 8px 10px; border-radius: 6px; }
.inline-add { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.inline-add input:not([type=color]) { flex: 1 1 220px; }
.inline-add input[type=color] { width: 60px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 12px; }
.st-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
code { font-size: 12px; background: var(--soft); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }

/* ---------- телефон ---------- */
@media (max-width: 820px) {
  body.app { grid-template-columns: minmax(0, 1fr); padding-bottom: 62px; }
  .side { display: none; }
  .top { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .gsearch { flex: 1 1 100%; max-width: none; order: 2; }
  .top .new { display: none; }
  #presence { order: 1; width: 100%; }
  #presence .presence { width: 100%; }
  .tog { flex: 1; min-height: 40px; }
  .split { grid-template-columns: minmax(0, 1fr); height: auto; }
  .panel, .list { min-width: 0; }
  .split.has-card .list { display: none; }
  .split:not(.has-card) .panel { display: none; }
  .panel { padding: 10px; }
  .card .back { display: inline-flex; }
  .grid2, .profile, .adduser { grid-template-columns: 1fr; }
  .profile, .uact { padding-left: 4px; }
  dl.kv { grid-template-columns: 1fr; gap: 0; }
  dl.kv dd { margin-bottom: 8px; }
  button, .btn, input, select { min-height: 44px; }
  .btn.sm, button.sm, .toolbar button { min-height: 40px; }
  .accept { width: 100%; }
  .head-row form { width: 100%; }
  .people .pr .lbl { width: 100%; }
  .sheet { margin: 0; border-radius: 0; border: 0; padding: 14px 12px; }
  .totals { grid-template-columns: 1fr; }
  .fgrid, .grid3, .qgrid { grid-template-columns: 1fr; }
  table.grid td.sm { width: 70px; }
  table.set input[name=value], table.set input[name=name] { min-width: 170px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: #fff; border-top: 1px solid var(--line);
    z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; position: relative; }
  .tabbar a.on { color: var(--accent); }
  .tabbar .cnt { position: absolute; top: 6px; left: 55%; margin: 0; }
}
