/* Нажимаемые элементы: без заливки при касании, без задержки двойного тапа, без системного меню по долгому нажатию */
a, button, summary, label[for], select,
input[type="button"], input[type="submit"], input[type="reset"],
[role="button"], [role="tab"], [role="link"], [onclick] {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button, summary, input[type="button"], input[type="submit"], [role="button"], [role="tab"], .btn, nav a {
  -webkit-user-select: none;
  user-select: none;
}
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--c-primary, #2f80ed); outline-offset: 2px; }

:root {
  --c-primary: #2f80ed; --bg: #f4f6f9; --card: #fff; --line: #e1e5ea; --text: #1d2733; --muted: #6b7785;
  --danger: #d64545; --radius: 8px; --cookie-h: 0px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; min-height: 34px; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 6px; cursor: pointer; font: inherit; }
.btn:hover { background: #f0f3f7; }
.btn:active { background: #e6ebf1; }
.btn.primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn.primary:hover { background: #2672d6; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 3px 8px; min-height: 26px; font-size: 12px; }
.btn.on { background: #e3eefc; border-color: #b9d2f6; color: #1d5fc2; }
.btn[disabled] { opacity: .5; cursor: default; }
input[type=text], input[type=number], input[type=search], select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); min-height: 34px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
label.fld { display: block; margin-bottom: 10px; }
label.fld > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
label.fld select, label.fld input[type=text], label.fld input[type=number] { width: 100%; }

/* шапка */
.top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 17px; margin-right: 6px; }
.top .grow { flex: 1; }
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px; align-items: center; }
.filters input[type=search] { width: 200px; }

/* доска */
.board { display: flex; gap: 10px; padding: 4px 14px 24px; overflow-x: auto; align-items: flex-start; min-height: calc(100vh - 120px); }
.col { flex: 0 0 280px; background: #e9edf2; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 130px); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; font-weight: 600; }
.col-head .cnt { color: var(--muted); font-weight: 400; }
.col-body { padding: 4px 8px 8px; overflow-y: auto; min-height: 40px; flex: 1; }
.col.over { outline: 2px dashed var(--c-primary); outline-offset: -2px; }
.col-more { width: 100%; margin: 2px 0 6px; }
.col-add { margin: 0 8px 8px; }
.tcard { background: var(--card); border-radius: 6px; padding: 9px 10px; margin-bottom: 7px; box-shadow: 0 1px 2px rgba(20,30,50,.12); cursor: pointer; border-left: 3px solid transparent; }
.tcard:hover { box-shadow: 0 2px 6px rgba(20,30,50,.2); }
.tcard.drag { opacity: .4; }
.tcard .ttl { word-break: break-word; margin: 3px 0 6px; }
.tcard .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tnum { color: var(--muted); font-size: 12px; }

/* кружки и плашки */
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px; vertical-align: middle; }
.dot.none { border: 1.5px dashed #9aa5b1; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 7px; border-radius: 10px; background: #eef1f5; color: #33404d; white-space: nowrap; }
.ava { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #cfd9e6; color: #2b3a4c; font-size: 11px; font-weight: 600; }

/* список */
.list { padding: 4px 14px 24px; }
.grp { margin-bottom: 14px; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.grp-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-weight: 600; background: #f7f9fb; cursor: pointer; }
.grp-head .cnt { color: var(--muted); font-weight: 400; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.row:hover { background: #f5f8fc; }
.row .ttl { flex: 1; min-width: 0; word-break: break-word; }
.row .rt { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; justify-content: flex-end; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* модальные окна */
.modal-bg { position: fixed; inset: 0; background: rgba(20,30,45,.5); display: flex; justify-content: center; align-items: flex-start; padding: 24px 12px; overflow-y: auto; z-index: 20; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 900px; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal.narrow { max-width: 480px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { font-size: 17px; flex: 1; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.tgrid { display: grid; grid-template-columns: 1fr 240px; gap: 16px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 10px; }
.tab { border: 0; background: none; padding: 8px 12px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; color: var(--muted); }
.tab.on { color: var(--text); border-bottom-color: var(--c-primary); }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }

/* WYSIWYG */
.wys-bar { display: flex; gap: 3px; flex-wrap: wrap; margin-bottom: 4px; }
.wys-bar .btn { min-width: 32px; justify-content: center; padding: 3px 8px; min-height: 28px; }
.wys { min-height: 130px; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; background: #fff; }
.wys:focus-visible { outline-offset: 0; }
.body-html p { margin: 0 0 8px; } .body-html ul, .body-html ol { margin: 0 0 8px 18px; padding: 0; }
.body-html blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--line); color: #4a5866; }
.body-html pre { background: #f2f4f7; padding: 8px; border-radius: 6px; overflow-x: auto; }
.body-html a, .wys a { color: var(--c-primary); }

/* вложения, комментарии, история */
.files { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.file { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: #f4f6f9; border-radius: 6px; }
.file a { flex: 1; min-width: 0; word-break: break-all; color: var(--c-primary); }
.cm { margin: 10px 0; }
.cm .cm-head { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cm .cm-head b { color: var(--text); }
.cm .cm-text { white-space: pre-wrap; word-break: break-word; margin: 2px 0 4px; }
.cm .cm-act { display: flex; gap: 10px; font-size: 12px; }
.cm .cm-act button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 0; font: inherit; }
.cm .cm-act button:hover { color: var(--text); }
.cm-kids { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 12px; }
.hist { font-size: 13px; }
.hist div { padding: 4px 0; border-bottom: 1px dashed var(--line); }

/* настройки */
.srow { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.srow input[type=text] { flex: 1; min-width: 120px; }
.srow input[type=number] { width: 90px; }
.swatches { display: flex; gap: 5px; flex-wrap: wrap; padding: 6px; background: #f4f6f9; border-radius: 6px; margin: 4px 0; }
.sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sw.sel { border-color: #1d2733; }
.dotbtn { border: 0; background: none; padding: 6px; cursor: pointer; }
.matrix { border-collapse: collapse; }
.matrix th, .matrix td { padding: 6px 12px; text-align: center; border-bottom: 1px solid var(--line); }
.matrix td:first-child { text-align: left; }

/* уведомления и cookie */
#toast-box { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--cookie-h) + 16px); z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast-msg { background: #1d2733; color: #fff; padding: 8px 14px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.toast-msg.toast-bad { background: #b3261e; color: #fff; }
#cookie-bar { position: fixed; left: 0; right: 0; bottom: 0; background: #1d2733; color: #fff; padding: 10px 14px; display: flex; gap: 12px; align-items: center; z-index: 30; font-size: 13px; }
#cookie-bar[hidden] { display: none; }
#cookie-bar span { flex: 1; }
body.has-cookie { padding-bottom: var(--cookie-h); }
.gate { max-width: 420px; margin: 60px auto; text-align: center; padding: 20px; color: var(--muted); }

@media (max-width: 700px) {
  .tgrid { grid-template-columns: 1fr; }
  .col { flex-basis: 84vw; }
  .filters input[type=search] { width: 100%; }
  .modal-bg { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  #cookie-bar { flex-direction: column; align-items: stretch; }
  .btn { min-height: 40px; }
  .btn.small { min-height: 32px; }
}
@media print { .top, .filters, #cookie-bar { display: none; } }
