:root {
  --honey: #F6B11F;
  --honey-d: #D99608;
  --honey-50: #FFF6DF;
  --honey-100: #FDEBBE;
  --navy: #16213E;
  --navy-2: #24345C;
  --navy-50: #EEF1F8;
  --bg: #F7F6F2;
  --card: #FFFFFF;
  --line: #E7E3D8;
  --line-2: #F0EDE5;
  --text: #1C2233;
  --muted: #6B7183;
  --red: #D93F45;
  --red-50: #FDECEC;
  --green: #23935F;
  --green-50: #E5F5EC;
  --blue: #3567D6;
  --blue-50: #EAF0FD;
  --violet: #7A55C9;
  --violet-50: #F1ECFB;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22, 33, 62, .06), 0 2px 8px rgba(22, 33, 62, .05);
  --shadow-lg: 0 8px 28px rgba(22, 33, 62, .14);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { color: var(--honey-d); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; color: var(--navy); }
h1 { font-size: 24px; font-weight: 750; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.pre { white-space: pre-wrap; word-wrap: break-word; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- шапка ---------- */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; }
.topbar-in { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 56px; }
.logo { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; font-size: 17px; letter-spacing: .01em; white-space: nowrap; }
.logo:hover { color: #fff; }
.logo .hex { width: 28px; height: 28px; }
.logo small { font-weight: 600; color: var(--honey); font-size: 13px; }
.mainnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { color: #C9D1E6; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.mainnav a.on { color: var(--navy); background: var(--honey); }
.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--honey); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex: none; }
.avatar.client { background: #9BB3E8; }
.usermenu form { margin: 0; }
.linkbtn { background: none; border: 0; color: #C9D1E6; font: inherit; font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.linkbtn:hover { color: #fff; background: rgba(255,255,255,.07); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 22px 16px 60px; }
.wrap.narrow { max-width: 880px; }

/* ---------- шапка компании и вкладки ---------- */
.co-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.co-head h1 { margin: 0; }
.co-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 20px; padding: 2px 16px 10px; border-bottom: 1px solid var(--line); scroll-snap-type: x proximity; scroll-padding: 0 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; color: var(--navy-2); font-weight: 600; font-size: 14px; background: var(--card); border: 1px solid var(--line); scroll-snap-align: start; }
.tabs a:hover { border-color: var(--honey); color: var(--navy); }
.tabs a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs .badge { margin-left: 6px; }

/* ---------- элементы ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.grid > .card + .card { margin-top: 0; }
.card.flat { box-shadow: none; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-h h2, .card-h h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 960px) { .g2, .g3, .g-main { grid-template-columns: minmax(0, 1fr); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; background: var(--honey); color: var(--navy); font: inherit; font-weight: 700; font-size: 14px; padding: 9px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 40px; }
.btn:hover { background: #FFC03B; color: var(--navy); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.dark:hover { background: var(--navy-2); color: #fff; }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--navy-2); }
.btn.ghost:hover { border-color: var(--honey); }
.btn.danger { background: var(--card); color: var(--red); border-color: #F2C4C6; }
.btn.danger:hover { background: var(--red-50); }
.btn.sm { padding: 5px 10px; font-size: 13px; min-height: 32px; border-radius: 8px; }
.btn.block { width: 100%; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--navy-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: #fff; border: 1px solid #D9D4C7; border-radius: 10px; padding: 9px 12px; min-height: 42px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--honey); box-shadow: 0 0 0 3px rgba(246, 177, 31, .22); }
input[type=file] { font-size: 14px; max-width: 100%; }
.filebtn { position: relative; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 7px 14px; min-height: 38px; border: 1px dashed #CDBF98; border-radius: 10px; background: var(--honey-50); color: var(--navy-2); font-weight: 700; font-size: 14px; cursor: pointer; }
.filebtn:hover { border-color: var(--honey-d); }
.filebtn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 0; }
.filenames { display: inline-block; margin-left: 8px; }
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 12px; }
.fields .field { margin: 0; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; color: var(--navy-2); cursor: pointer; margin: 0; }
.check input { width: 17px; height: 17px; accent-color: var(--honey-d); }

details.add { background: var(--card); border: 1px dashed #D7CFB9; border-radius: var(--radius); margin-bottom: 16px; }
details.add > summary { cursor: pointer; list-style: none; padding: 12px 16px; font-weight: 700; color: var(--navy-2); }
details.add > summary::-webkit-details-marker { display: none; }
details.add > summary::before { content: "+"; display: inline-flex; width: 22px; height: 22px; border-radius: 6px; background: var(--honey); color: var(--navy); align-items: center; justify-content: center; margin-right: 8px; font-weight: 800; }
details.add[open] > summary { border-bottom: 1px solid var(--line-2); }
details.add > .body { padding: 16px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--navy-50); color: var(--navy-2); white-space: nowrap; line-height: 1.6; }
.badge.honey { background: var(--honey-100); color: #7A5300; }
.badge.red { background: var(--red-50); color: var(--red); }
.badge.green { background: var(--green-50); color: var(--green); }
.badge.blue { background: var(--blue-50); color: var(--blue); }
.badge.violet { background: var(--violet-50); color: var(--violet); }
.badge.gray { background: #F0F0EC; color: var(--muted); }
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; align-items: center; justify-content: center; }
.count.honey { background: var(--honey); color: var(--navy); }
.tag-internal { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--violet); background: var(--violet-50); border-radius: 6px; padding: 1px 6px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; border: 1px solid; }
.flash.ok { background: var(--green-50); color: #17663F; border-color: #BFE3CF; }
.flash.err { background: var(--red-50); color: #9E2227; border-color: #F2C4C6; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }

/* ---------- вход ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 10% -10%, var(--honey-50), transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--navy-50), transparent 60%), var(--bg); }
.login-box { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; justify-content: center; }
.login-brand .hex { width: 46px; height: 46px; }
.login-brand b { font-size: 24px; color: var(--navy); font-weight: 800; }
.login-brand span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.login-box .card { padding: 26px; }
.login-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ---------- канбан ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(4, minmax(78vw, 300px)); margin: 0 -16px; padding: 0 16px 10px; scroll-padding: 0 16px; } }
.col { background: #EFECE3; border-radius: 14px; padding: 10px; scroll-snap-align: start; min-height: 120px; }
.col-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 800; color: var(--navy); font-size: 14px; }
.col-h .n { background: rgba(22,33,62,.08); border-radius: 999px; padding: 0 9px; font-size: 12px; color: var(--navy-2); }
.col-h .stripe { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.col[data-status=todo] .stripe { background: #A6AEC2; }
.col[data-status=doing] .stripe { background: var(--honey); }
.col[data-status=review] .stripe { background: var(--violet); }
.col[data-status=done] .stripe { background: var(--green); }
.col-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.tcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); color: var(--text); position: relative; }
.tcard:hover { color: var(--text); border-color: var(--honey); }
.tcard.can-drag { cursor: grab; touch-action: manipulation; }
.tcard .t { font-weight: 650; font-size: 14px; line-height: 1.35; margin-bottom: 6px; }
.tcard .meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); }
.tcard .meta .sp { flex: 1; }
.tcard .co { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--honey-d); margin-bottom: 3px; }
.tcard.overdue { border-left: 3px solid var(--red); }
.who { display: inline-flex; align-items: center; gap: 5px; }
.who .avatar { width: 22px; height: 22px; font-size: 10px; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-lg); }
.sortable-drag { transform: rotate(1.5deg); }
.drag-hint { font-size: 13px; color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 180px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg a { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--navy-2); }
.seg a.on { background: var(--navy); color: #fff; }

/* ---------- задача / баг ---------- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; }
.msg .bubble { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.msg.client .bubble { background: #F4F7FE; border-color: #DCE4F7; }
.msg.internal .bubble { background: var(--violet-50); border-color: #DCCFF5; border-style: dashed; }
.msg .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; margin-bottom: 3px; }
.msg .head b { color: var(--navy); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; font-size: 13px; max-width: 100%; }
.file .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; font-weight: 600; }
.file .ic { width: 28px; height: 28px; border-radius: 6px; background: var(--honey-50); color: var(--honey-d); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; text-transform: uppercase; flex: none; }
.thumb { display: block; width: 120px; height: 90px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f3f3f3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs-lg .thumb { width: 100%; height: auto; max-height: 420px; }
.thumbs-lg .thumb img { object-fit: contain; max-height: 420px; background: #fafafa; }
.history { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.history li { padding: 7px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 8px; }
.history li:last-child { border: 0; }
.history .when { color: var(--muted); white-space: nowrap; min-width: 92px; }

/* ---------- карта развития ---------- */
.progress { height: 10px; background: #ECE8DC; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--honey), #FFCB4D); border-radius: 999px; }
.progress.sm { height: 6px; }
.rm-summary { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.rm-summary .big { font-size: 34px; font-weight: 800; color: var(--navy); line-height: 1; }
.timeline { position: relative; margin: 8px 0 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 19px; top: 8px; bottom: 8px; width: 3px; background: #E3DECF; border-radius: 3px; }
.tl-item { position: relative; padding-left: 56px; margin-bottom: 14px; }
.tl-node { position: absolute; left: 6px; top: 14px; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; background: #fff; border: 3px solid #CFC8B5; color: var(--muted); z-index: 1; }
.tl-item.doing .tl-node { border-color: var(--honey); background: var(--honey); color: var(--navy); box-shadow: 0 0 0 6px rgba(246,177,31,.22); }
.tl-item.done .tl-node { border-color: var(--green); background: var(--green); color: #fff; }
.tl-item.done .card { opacity: .92; }
.tl-item.doing .card { border-color: var(--honey); box-shadow: 0 4px 18px rgba(246,177,31,.18); }
.tl-item .card { padding: 14px 16px; }
.tl-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.tl-top h3 { margin: 0 0 2px; font-size: 16px; }
.tl-dates { font-size: 13px; color: var(--muted); }
.tl-item.done + .tl-item::before, .tl-item.done::after { content: ""; }
.timeline .done-line { position: absolute; left: 19px; top: 8px; width: 3px; background: var(--green); border-radius: 3px; }

/* ---------- списки ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.row.overdue { border-color: #F0B7BA; background: linear-gradient(90deg, var(--red-50), #fff 40%); border-left: 4px solid var(--red); }
.row.done { opacity: .75; }
.row-top { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.row-top h3 { margin: 0; font-size: 15px; }
.row .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.row details { margin-top: 10px; }
.row details > summary { cursor: pointer; color: var(--navy-2); font-weight: 600; font-size: 14px; }
.ticon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 16px; background: var(--honey-50); }

.prio-critical { color: var(--red); }
.bug-row { display: flex; gap: 12px; align-items: flex-start; color: var(--text); }
.bug-row:hover { color: var(--text); }
.bug-row .thumb { width: 72px; height: 56px; flex: none; }
.bug-row .main { flex: 1; min-width: 0; }

/* ---------- сводка ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 28px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat.hot .n { color: var(--red); }
.hotlist { list-style: none; margin: 0; padding: 0; }
.hotlist li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); align-items: flex-start; font-size: 14px; }
.hotlist li:last-child { border: 0; }
.hotlist .co { font-size: 12px; font-weight: 800; color: var(--honey-d); text-transform: uppercase; letter-spacing: .03em; }
.hotlist .t { font-weight: 600; color: var(--text); }
.hotlist .when { margin-left: auto; white-space: nowrap; font-size: 12px; }
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.client-card { display: block; color: var(--text); }
.client-card:hover { color: var(--text); border-color: var(--honey); }
.client-card .name { font-weight: 800; font-size: 16px; color: var(--navy); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.client-card .stage { font-size: 13px; color: var(--muted); margin: 6px 0 8px; min-height: 20px; }
.client-card .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- таблица ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table-wrap { overflow-x: auto; }

.secret-val { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--navy-50); padding: 3px 8px; border-radius: 6px; word-break: break-all; }
.pw-once { background: var(--honey-50); border: 2px solid var(--honey); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.pw-once code { font-size: 18px; font-weight: 800; background: #fff; padding: 4px 10px; border-radius: 8px; display: inline-block; margin-top: 4px; }

/* ---------- отчёт ---------- */
.report { background: #fff; max-width: 860px; margin: 24px auto; padding: 40px 44px; border-radius: 14px; box-shadow: var(--shadow); }
.report h1 { font-size: 26px; }
.report .day { margin-top: 18px; }
.report .day h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.report ul { margin: 6px 0 0; padding-left: 20px; }
.report li { margin-bottom: 6px; }
.report-bar { max-width: 860px; margin: 18px auto 0; display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px; }
@media (max-width: 600px) { .report { padding: 22px 18px; margin: 12px; } }
@media print {
  body { background: #fff; }
  .report-bar, .topbar, .noprint { display: none !important; }
  .report { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* ---------- общие для адаптива ---------- */
body { overflow-x: clip; }
.burger, .colnav, .tmove, .narrow-only { display: none; }
.stripe.s-todo, .stripe.s-doing, .stripe.s-review, .stripe.s-done { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; flex: none; }
.s-todo { background: #A6AEC2; } .s-doing { background: var(--honey); } .s-review { background: var(--violet); } .s-done { background: var(--green); }
.tcard { position: relative; }
.tcard .tlink { display: block; color: var(--navy); }
.tcard .tlink::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.tcard .tlink:hover { color: var(--navy); }
.tcard .tmove { position: relative; z-index: 2; }
.col-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 6px; border: 1px dashed #D8D2C2; border-radius: 10px; }
.col-empty:not(:only-child) { display: none; }
.hotlist li { position: relative; }
.hotlist a.t::after { content: ""; position: absolute; inset: 0; }
.hotlist form, .hotlist .btn { position: relative; z-index: 1; }
td a { overflow-wrap: anywhere; }
.secret-val, .row .meta span { overflow-wrap: anywhere; }

/* нижняя шторка «Переместить в…» */
.sheet { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.sheet.hidden { display: none !important; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(22, 33, 62, .45); }
.sheet-body { position: relative; width: 100%; max-width: 520px; background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-lg); }
.sheet-title { font-weight: 800; font-size: 18px; color: var(--navy); }
.sheet-task { font-size: 15px; margin-bottom: 4px; }
.sheet-opt { justify-content: flex-start; }
.sheet-opt[aria-current] { background: var(--navy); color: #fff; border-color: var(--navy); }
body.sheet-open { overflow: hidden; }

/* переключатель колонок канбана */
.colnav { gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 16px; }
.colnav::-webkit-scrollbar { display: none; }
.colnav button { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--navy-2); font: inherit; font-weight: 700; font-size: 15px; padding: 0 14px; min-height: 44px; border-radius: 999px; cursor: pointer; }
.colnav button b { background: rgba(22,33,62,.08); border-radius: 999px; padding: 0 8px; font-size: 14px; }
.colnav button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.colnav button.on b { background: rgba(255,255,255,.18); }

.quickmove .label { font-size: 15px; font-weight: 700; color: var(--navy-2); margin-bottom: 6px; }
.quickmove-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.quickmove-opts .btn { justify-content: flex-start; }
.quickmove-opts .btn[disabled] { opacity: 1; cursor: default; }

/* бургер */
.burger { position: static; margin-left: auto; }
.burger > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px 0 0; cursor: pointer; }
.burger > summary::-webkit-details-marker { display: none; }
.burger .bars { display: inline-flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; align-items: center; border-radius: 10px; background: rgba(255,255,255,.08); }
.burger .bars i { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
.burger[open] .bars i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[open] .bars i:nth-child(2) { opacity: 0; }
.burger[open] .bars i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.burger-panel { position: absolute; left: 0; right: 0; top: 100%; background: var(--navy); padding: 8px 16px 16px; box-shadow: 0 14px 28px rgba(0,0,0,.25); border-top: 1px solid rgba(255,255,255,.08); }
.burger-user { color: #fff; font-weight: 700; padding: 8px 0 10px; font-size: 16px; }
.burger-user span { display: block; color: #9FA9C4; font-weight: 400; font-size: 15px; overflow-wrap: anywhere; }
.burger-panel nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.burger-panel nav a { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-radius: 10px; color: #E3E8F4; font-weight: 600; font-size: 16px; }
.burger-panel nav a.on { background: var(--honey); color: var(--navy); }

@media (max-width: 960px) {
  .narrow-only { display: block; }
  dl.narrow-only { display: grid; }
  .wide-only { display: none !important; }
}

/* ---------- касание: планшет и телефон ---------- */
@media (max-width: 1100px) {
  .colnav { display: flex; }
  .board { grid-template-columns: repeat(4, minmax(46vw, 360px)); }
}
@media (max-width: 1024px), (pointer: coarse) {
  .tmove { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 10px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--navy-2); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; }
  .btn, .btn.sm { min-height: 44px; font-size: 15px; }
  .btn.sm { padding: 8px 14px; }
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=url], select, textarea { min-height: 44px; font-size: 16px; }
  .tabs a, .seg a, .mainnav a { display: inline-flex; align-items: center; min-height: 44px; }
  .linkbtn { min-height: 44px; }
  .usermenu .avatar { width: 44px; height: 44px; }
  details.add > summary { display: flex; align-items: center; min-height: 50px; }
  .row details > summary, details > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; }
  label.check { min-height: 44px; }
  .filebtn { min-height: 44px; }
  .crumb a, a.small, .card-h a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  .file { min-height: 44px; }
  .table td a { display: inline-flex; align-items: center; min-height: 44px; }
  .history li { padding: 10px 0; }
  .small, .xs, .badge, .tcard .meta, .tcard .co, .hotlist .co, .hotlist .when, .crumb, label, .table th, .history,
  .kv, .msg .head, .tag-internal, .stat .l, .client-card .stage, .file, .tl-dates, .row .meta, .drag-hint,
  .filenames, .login-foot, .mainnav a, .linkbtn, .usermenu .uname, .tabs a, .seg a, .co-head .sub, .tcard .t, .muted, .login-brand span,
  .card-h a, .col-empty, .quick-periods, .col-h, .col-h .n, .colnav button b, .hotlist .t, .t, .table, .table td, .table b,
  details > summary, .row details > summary, .hotlist li, .empty, .filebtn, label.check, .tl-node, .report .day h3, .logo small, .burger-panel .btn, .count, .sheet-task, .tmove { font-size: 15px; }
  .count { min-width: 24px; height: 24px; }
  .btn { min-width: 44px; }
  .logo { min-height: 44px; }
  .check input { width: 22px; height: 22px; }
  .tl-node { width: 32px; height: 32px; }
  .badge { padding: 2px 9px; }
  .tcard .meta { gap: 6px; }
  .tcard .who .avatar { width: 26px; height: 26px; }
}

/* ---------- телефон ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 22px; }
  h2 { font-size: 19px; }
  .wrap { padding: 16px 16px 60px; }
  .topbar-in { gap: 10px; height: 60px; padding: 0 12px 0 16px; position: relative; }
  .mainnav, .usermenu { display: none; }
  .burger { display: block; }
  .card { padding: 16px; }
  .kv { grid-template-columns: 112px minmax(0, 1fr); }
  .file .nm { max-width: 180px; }
  .co-head { margin-bottom: 10px; }
  .tabs { margin-bottom: 16px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .board { grid-template-columns: repeat(4, 86vw); gap: 12px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .field { min-width: 0; }
  .filters .btn { width: 100%; }
  form .btnrow { align-items: stretch; }
  form .btnrow > .btn[type=submit], form > .btn[type=submit], form > .btnrow > .btn:only-child { width: 100%; }
  .btnrow > div.btnrow { width: 100%; }
  .row-top > .btnrow { width: 100%; }
  .row-top > .btnrow > .btn { flex: 1; }
  .row-top > div:first-child { flex-basis: 100%; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .n { font-size: 26px; }
  .hotlist li { flex-wrap: wrap; }
  .hotlist .when { margin-left: 0; }
  .clients { grid-template-columns: minmax(0, 1fr); }
  .msg .avatar { width: 30px; height: 30px; }
  .msg .bubble { padding: 10px 12px; }
  .tl-item { padding-left: 46px; }
  .timeline::before { left: 14px; }
  .tl-node { left: 1px; }
  .seg { width: 100%; }
  .seg a { flex: 1; justify-content: center; }
  .quick-periods .btn { flex: 1 1 auto; }

  /* таблицы -> карточки */
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack th { display: none; }
  .table.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
  .table.stack tr:first-child { padding-top: 0; }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { border: 0; padding: 2px 0; }
  .table.stack td.right { text-align: left; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
  .table.stack td.right > form, .table.stack td.right > a { flex: 1 1 auto; }
  .table.stack td.right .btn { width: 100%; }
  .table-wrap { overflow-x: visible; }

  .report-bar { flex-direction: column; align-items: stretch; }
  .report-bar form { flex-wrap: wrap; }
  .report-bar form input { flex: 1 1 140px; }
  .report-bar .btn { width: 100%; }
  .pw-once code { font-size: 17px; word-break: break-all; }
  .login-box .card { padding: 20px; }
  .sheet-body { max-width: none; border-radius: 18px 18px 0 0; }
}

/* ---------- режим «Как видит клиент» ---------- */
.preview-bar { position: sticky; top: 56px; z-index: 40; background: var(--honey); color: var(--navy); font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 8px 16px; font-size: 15px; box-shadow: 0 2px 8px rgba(22,33,62,.12); }
.preview-bar form { margin: 0; }
@media (max-width: 640px) { .preview-bar { top: 60px; justify-content: space-between; } .preview-bar .btn { width: 100%; } }
.s-open { background: var(--honey); } .s-accepted { background: var(--green); }
.stripe.s-open, .stripe.s-accepted { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; flex: none; }
.col[data-status=open] .stripe { background: var(--honey); }
.col[data-status=accepted] .stripe { background: var(--green); }
.waits-ctx .col[data-status=done] .stripe, .waits-ctx .s-done, .sheet.waits-sheet .s-done { background: var(--blue); }
.board.cols-3 { grid-template-columns: repeat(3, minmax(260px, 1fr)); }
@media (max-width: 1100px) { .board.cols-3 { grid-template-columns: repeat(3, minmax(46vw, 360px)); } }
@media (max-width: 640px) { .board.cols-3 { grid-template-columns: repeat(3, 86vw); } }
.tcard .tdone { position: relative; z-index: 2; display: flex; width: 100%; margin-top: 10px; }
.view-toggle { margin-bottom: 14px; }
.wb-group { margin-bottom: 14px; }
.wb-group h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 6px; }
.waits-block > summary { list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.waits-block > summary::-webkit-details-marker { display: none; }
.waits-block > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.waits-block:not([open]) > summary::after { content: "▸"; }
.hotlist li.od .t { color: var(--red); }
/* колонка «Ждём от вас» на доске задач */
.board.cols-5 { grid-template-columns: repeat(5, minmax(230px, 1fr)); }
.col.wcol { background: #FBEBC3; }
.col.wcol .col-h { color: #7A5300; }
.col.wcol .stripe, .stripe.s-wait { background: var(--honey-d); display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; flex: none; }
.wcol-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.wcard.sent { border-left: 3px solid var(--green); }
.tcard form.tdone { display: block; margin: 10px 0 0; }
@media (max-width: 1100px) { .board.cols-5 { grid-template-columns: repeat(5, minmax(46vw, 340px)); } }
@media (max-width: 640px) { .board.cols-5 { grid-template-columns: repeat(5, 86vw); } }

/* ---------- ИИ: «Закиньте сюда» ---------- */
.ai-box { background: linear-gradient(135deg, #FFF8E6, #FFFFFF 60%); border: 1.5px solid #F2CF7A; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.ai-box.drag { border-color: var(--honey-d); background: var(--honey-50); }
.ai-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; color: var(--navy); }
.ai-head b { font-size: 16px; }
.ai-badge { background: var(--navy); color: var(--honey); font-weight: 800; font-size: 12px; border-radius: 6px; padding: 2px 7px; }
.ai-hint { font-size: 13px; }
.ai-box textarea { min-height: 64px; background: #fff; }
.ai-box:focus-within textarea, .ai-box textarea:not(:placeholder-shown) { min-height: 110px; }
.ai-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ai-files:empty { display: none; }
.ai-file { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px 4px 4px; font-size: 13px; max-width: 100%; }
.ai-file img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.ai-file .x { border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; min-width: 32px; min-height: 32px; }
.ai-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.ai-actions select { width: auto; flex: 0 1 260px; }
.ai-actions .ai-go { margin-left: auto; }
.ai-go[disabled] { opacity: .8; cursor: progress; }
.ai-fab { display: none; }
details.add { border: 0; background: none; margin-bottom: 10px; }
details.add > summary { display: inline-flex; padding: 4px 2px; font-weight: 600; font-size: 14px; color: var(--muted); }
details.add > summary::before { width: 18px; height: 18px; font-size: 13px; background: var(--line); color: var(--navy-2); }
details.add > summary::after { content: " · вручную"; margin-left: 4px; }
details.add[open] { background: var(--card); border: 1px dashed #D7CFB9; border-radius: var(--radius); }
details.add[open] > summary { padding: 10px 14px; }
.ai-warn { background: var(--honey-50); border-color: #F2CF7A; margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.ai-company { margin: 18px 0 8px; }
.ai-op { padding: 12px 14px; }
.ai-check { display: flex; gap: 12px; align-items: flex-start; margin: 0; cursor: pointer; font-weight: 400; font-size: 15px; color: var(--text); }
.ai-check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--green); flex: none; }
.ai-op-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ai-op-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-op-title { color: var(--navy); font-size: 15px; }
.ai-similar { color: #9A6400; font-size: 13px; font-weight: 600; }
.ai-quote { color: var(--muted); font-size: 13px; font-style: italic; }
.ai-edit { margin: 6px 0 0 34px; }
.ai-edit > summary { color: var(--navy-2); font-size: 13px; cursor: pointer; }
.ai-apply-bar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); margin-top: 10px; z-index: 5; }
.ai-apply-btn { min-height: 54px; font-size: 17px; }
.flash[data-undo-flash] { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
@media (max-width: 1024px), (pointer: coarse) {
  .ai-hint, .ai-similar, .ai-quote, .ai-edit > summary, .ai-badge, .ai-file { font-size: 15px; }
  details.add > summary { min-height: 44px; font-size: 15px; }
}
@media (max-width: 640px) {
  .ai-box { padding: 12px; margin-left: -4px; margin-right: -4px; }
  .ai-actions select { flex: 1 1 100%; }
  .ai-actions .ai-go { flex: 1 1 auto; margin-left: 0; }
  .wrap { padding-bottom: 96px; }
  .ai-fab { display: inline-flex; align-items: center; justify-content: center; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60; min-height: 54px; padding: 0 20px; border-radius: 999px; background: var(--navy); color: var(--honey); font-weight: 800; font-size: 16px; box-shadow: 0 8px 24px rgba(22,33,62,.35); }
  .ai-fab:hover { color: var(--honey); }
  body.sheet-open .ai-fab { display: none; }
  .ai-edit { margin-left: 0; }
}
