:root {
  --bg: #ffffff;
  --text: #222;
  --muted: #8a8f98;
  --line: #e4e6ea;
  --card: #ffffff;
  --link: #2a6fdb;
  --danger: #d6322b;
  --ok: #2e9b4a;
  --accent: #f26a1b;
  --col-gray: #eceded;
  --col-yellow: #fdf4df;
  --col-orange: #fde9e1;
  --col-green: #e6f4e2;
  --col-blue: #e3eefb;
  --col-purple: #eee6f8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 1px 4px rgba(0, 0, 0, .04);
  --radius: 6px;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body { background: var(--bg); font-size: 15px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
.hidden { display: none !important; }

/* ---------- вход ---------- */
.login { min-height: 100%; display: grid; place-items: center; background: #f4f5f7; padding: 16px; }
.login form { width: 100%; max-width: 340px; background: #fff; padding: 28px; border-radius: 10px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login p { margin: 0; color: var(--muted); font-size: 14px; }

.field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select, .input {
  width: 100%; border: 1px solid #d5d8dd; border-radius: 6px; padding: 8px 10px; background: #fff; color: var(--text); font-size: 15px;
}
.field input:focus, .field textarea:focus, .field select:focus, .input:focus { outline: 2px solid rgba(42, 111, 219, .25); border-color: var(--link); }
.btn { border: 0; border-radius: 6px; padding: 8px 14px; background: var(--link); color: #fff; font-weight: 500; }
.btn:hover { filter: brightness(1.07); }
.btn.secondary { background: #eef0f3; color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); padding-left: 0; padding-right: 0; }
.btn:disabled { opacity: .6; cursor: default; }
.error { color: var(--danger); font-size: 14px; min-height: 1em; }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; gap: 10px; padding: 6px 16px 10px 30px; min-height: 56px; }
.back { border: 0; background: none; color: var(--accent); font-size: 30px; line-height: 1; padding: 0 4px 4px; margin-left: -18px; }
.board-title { font-size: 26px; font-weight: 600; border: 0; background: none; padding: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.round-btn { width: 40px; height: 34px; border-radius: 17px; border: 1px solid var(--line); background: #fff; font-size: 24px; line-height: 1; color: #555; flex: none; box-shadow: var(--shadow); }
.round-btn:hover { color: var(--link); }
.top .spacer { flex: 1; }
.search { width: 220px; border: 1px solid var(--line); border-radius: 17px; padding: 6px 14px; font-size: 14px; }
.filter-mine { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.people { display: flex; flex-direction: row-reverse; }
.people .avatar { width: 34px; height: 34px; margin-left: -8px; border: 2px solid #fff; font-size: 13px; }
.me { border: 0; background: none; padding: 0; margin-left: 6px; }
.me .avatar { width: 34px; height: 34px; font-size: 13px; }

/* ---------- доска ---------- */
.board { display: flex; gap: 14px; padding: 0 16px 16px 34px; overflow-x: auto; height: calc(100vh - 66px); align-items: stretch; }
.column { flex: 0 0 326px; display: flex; flex-direction: column; border-radius: 4px; max-height: 100%; min-height: 0; }
.column.c-gray { background: var(--col-gray); }
.column.c-yellow { background: var(--col-yellow); }
.column.c-orange { background: var(--col-orange); }
.column.c-green { background: var(--col-green); }
.column.c-blue { background: var(--col-blue); }
.column.c-purple { background: var(--col-purple); }
.col-head { padding: 12px 20px 8px; font-size: 20px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.col-head .count { color: var(--muted); font-weight: 400; font-size: 18px; }
.col-body { flex: 1; overflow-y: auto; padding: 0 7px 6px; min-height: 40px; }
.col-body.drop { outline: 2px dashed rgba(42, 111, 219, .45); outline-offset: -4px; }
.col-foot { display: flex; align-items: center; padding: 8px 18px 10px; color: var(--muted); }
.add-card { border: 0; background: none; color: var(--muted); display: flex; align-items: center; gap: 8px; font-size: 15px; padding: 2px 0; }
.add-card b { font-size: 22px; font-weight: 300; line-height: 1; }
.add-card:hover { color: var(--link); }
.new-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; margin: 0 0 8px; display: grid; gap: 8px; }
.new-card textarea { border: 0; resize: none; min-height: 60px; outline: none; }
.new-card .row { display: flex; gap: 8px; justify-content: flex-end; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 13px 10px; margin-bottom: 8px; cursor: pointer; position: relative; }
.card:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.card.dragging { opacity: .4; }
.card .who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; margin-bottom: 8px; min-width: 0; }
.card .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .title { font-size: 15px; line-height: 1.33; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.card .comment { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14.5px; margin-top: 6px; min-width: 0; }
.card .comment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .comment .avatar { width: 18px; height: 18px; font-size: 8px; }
.card .thumbs { display: flex; gap: 8px; margin-top: 8px; }
.card .thumbs .thumb { width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 2px; object-fit: cover; background: #fafafa; display: grid; place-items: center; font-size: 11px; color: var(--muted); overflow: hidden; }
.card .meta { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 4px; font-size: 15px; min-height: 18px; }
.card .meta .due { color: var(--muted); }
.card .meta .due.overdue { color: var(--danger); }
.card .meta .badge { color: var(--muted); font-size: 13px; }
.card .check { color: var(--ok); font-size: 20px; line-height: 1; }

.avatar { width: 26px; height: 26px; border-radius: 4px; flex: none; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 600; object-fit: cover; background: #c9ccd1; letter-spacing: .3px; }
.avatar.ghost { background: #e8eaee; color: #b3b8c0; }

/* ---------- модальные окна ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 24, 31, .38); display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; overflow-y: auto; z-index: 10; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 760px; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); position: relative; }
.modal.small { max-width: 440px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.modal-head h2 { margin: 0; font-size: 19px; flex: 1; }
.close { border: 0; background: none; font-size: 26px; color: var(--muted); line-height: 1; padding: 0 4px; }
.modal-body { padding: 16px 20px 20px; display: grid; gap: 14px; }
.detail { display: grid; grid-template-columns: 1fr 220px; gap: 22px; }
.detail .title-input { font-size: 19px; font-weight: 600; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; margin-left: -9px; resize: none; width: calc(100% + 9px); line-height: 1.35; overflow: hidden; }
.detail .title-input:hover, .detail .title-input:focus { border-color: #d5d8dd; outline: none; }
.detail textarea.desc { min-height: 110px; resize: vertical; }
.side { display: grid; gap: 14px; align-content: start; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 15px; padding: 3px 9px 3px 3px; font-size: 13.5px; background: #fff; }
.chip .avatar { width: 22px; height: 22px; border-radius: 50%; font-size: 9px; }
.chip button { border: 0; background: none; color: var(--muted); padding: 0 0 0 2px; font-size: 15px; line-height: 1; }
.section-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 6px 0 0; }
.files { display: grid; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.file img, .file .ext { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 3px; object-fit: cover; flex: none; display: grid; place-items: center; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.file .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .size { color: var(--muted); font-size: 12.5px; }
.file button { border: 0; background: none; color: var(--muted); font-size: 18px; }
.upload { border: 1px dashed #c8ccd2; border-radius: 6px; padding: 10px; text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; }
.upload.drop { border-color: var(--link); color: var(--link); background: #f3f7fe; }
.comments { display: grid; gap: 12px; }
.cm { display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
.cm .avatar { width: 30px; height: 30px; }
.cm .head { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.cm .head b { color: var(--text); font-weight: 600; }
.cm .head button { border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 0; margin-left: auto; }
.cm .text { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; margin-top: 2px; }
.comment-form { display: grid; gap: 8px; }
.comment-form textarea { min-height: 60px; resize: vertical; }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }

.menu { position: fixed; z-index: 20; background: #fff; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); padding: 6px; min-width: 240px; max-height: 70vh; overflow-y: auto; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 5px; font-size: 14.5px; }
.menu button:hover { background: #f1f3f6; }
.menu button.active { font-weight: 600; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table td, .table th { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.table .avatar { width: 28px; height: 28px; }
.table .muted { color: var(--muted); }
.link-btn { border: 0; background: none; color: var(--link); padding: 0; font-size: 13.5px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.notice { background: #fff8e1; border: 1px solid #f3df9b; border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.notice code { font-size: 15px; background: #fff; padding: 1px 6px; border-radius: 4px; user-select: all; }
.col-edit { display: grid; grid-template-columns: 1fr 110px auto auto auto; gap: 6px; align-items: center; }
.col-edit label { font-size: 13px; color: var(--muted); display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #2b2f36; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 30; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 6px 16px 8px 26px; }
  .board-title { font-size: 20px; flex: 1; }
  .search { order: 5; width: 100%; }
  .filter-mine { order: 6; }
  .people { display: none; }
  .board { padding: 0 16px 16px; height: calc(100vh - 110px); scroll-snap-type: x mandatory; }
  .column { flex-basis: calc(100vw - 48px); scroll-snap-align: start; }
  .detail { grid-template-columns: 1fr; }
  .overlay { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  .inline-form { grid-template-columns: 1fr; }
  .col-edit { grid-template-columns: 1fr 1fr; }
}
