/* Жоспар — продуктовая доска (plan.js). */

main { max-width: 1320px; }
.pm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.pm-head .btn { white-space: nowrap; }

/* виды — сегмент как в iOS */
.pm-views { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 12px; border-radius: 12px;
  background: var(--surface-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.pm-views::-webkit-scrollbar { display: none; }
.pm-views button { border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--ink-2); padding: 7px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s; }
.pm-views button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

/* фильтры */
.pm-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.pm-filters input[type=search] { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font: inherit; font-size: 13.5px; min-width: 180px; }
.pm-filters select { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font: inherit; font-size: 13px; color: var(--ink-2); }
/* Направления — одной строкой с прокруткой: в столбик они съедали экран. */
.pm-chips { order: 3; flex: 1 0 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pm-chips::-webkit-scrollbar { display: none; }
.pm-fchip { flex: 0 0 auto; }
.pm-fchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 12.5px; color: var(--ink-2);
  cursor: pointer; transition: background .15s, border-color .15s; }
.pm-fchip:hover { border-color: var(--c, var(--line)); }
.pm-fchip.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, white); color: var(--ink); }
.pm-fchip.clear { color: var(--ink-3); }
.pm-dot { display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; }

.pm-main .empty-note, .pm-empty { color: var(--ink-3); font-size: 13px; padding: 10px 0; text-align: center; }
.pm-hint { margin: 0 0 10px; font-size: 12px; color: var(--ink-3); }

/* значки */
.pm-pr { flex: 0 0 auto; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.pm-p0 { background: var(--low-bg); color: var(--low); }
.pm-p1 { background: var(--mid-bg); color: var(--mid); }
.pm-p2 { background: var(--surface-2); color: var(--ink-2); }
.pm-p3 { background: transparent; color: var(--ink-3); border: 1px solid var(--line); }
.pm-ef { font-size: 11px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.pm-date { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.pm-date.late { color: var(--low); font-weight: 600; }
.pm-date.ok { color: var(--green-dark); }
.pm-st.doing { font-size: 11px; color: var(--violet); background: var(--violet-bg); padding: 2px 7px; border-radius: 6px; }

/* ── шолу ── */
.pm-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.pm-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); font: inherit; cursor: pointer;
  text-align: left; transition: transform .1s, border-color .15s; }
.pm-tile:hover { border-color: var(--ink-3); }
.pm-tile:active { transform: scale(.98); }
.pm-tile b { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.pm-tile span { font-size: 12.5px; color: var(--ink-2); }
.pm-tile.doing b { color: var(--violet); }
.pm-tile.next b { color: var(--mid); }
.pm-tile.late b { color: var(--low); }
.pm-tile.done b { color: var(--green-dark); }

.pm-ov { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pm-box { padding: 16px 18px; }
.pm-box h2, .pm-dir h2 { margin: 0 0 2px; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.pm-line { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 6px; border: 0;
  border-top: 1px solid var(--line-2); background: transparent; font: inherit; text-align: left; cursor: pointer;
  border-radius: 8px; }
.pm-line:hover { background: var(--surface-2); }
.pm-line-t { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-vel { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.pm-vel-c { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.pm-vel-c i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 2px 2px; background: var(--green); opacity: .85; }
.pm-vel-c:last-child i { background: var(--green-dark); opacity: 1; }
.pm-vel-c small { font-size: 10px; color: var(--ink-3); height: 12px; }
.pm-vel-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.pm-prog { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; padding: 7px 4px; border: 0; background: transparent; font: inherit; cursor: pointer; border-radius: 8px; text-align: left; }
.pm-prog:hover { background: var(--surface-2); }
.pm-prog-n { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-prog-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.pm-prog-bar i { display: block; height: 100%; border-radius: 3px; }
.pm-prog-v { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.pm-prog-v em { font-style: normal; color: var(--violet); }

/* ── тақта ── */
.pm-board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto;
  padding-bottom: 8px; align-items: start; }
.pm-col { background: var(--surface-2); border-radius: 16px; padding: 10px; min-height: 120px; }
.pm-col header { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.pm-col header b { font-size: 13.5px; font-weight: 650; }
.pm-col header span { font-size: 12px; color: var(--ink-3); }
.pm-col-add { margin-left: auto; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); font-size: 18px; line-height: 1; cursor: pointer; }
.pm-col-add:hover { background: var(--surface); }
.pm-col-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; border-radius: 12px; transition: background .15s; }
.pm-col-body.over { background: color-mix(in srgb, var(--green) 8%, transparent); outline: 2px dashed var(--green-line); }
.pm-card { position: relative; padding: 10px 12px 10px 14px; background: var(--surface); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06); border: 1px solid var(--line); cursor: grab; transition: box-shadow .15s, transform .1s; }
.pm-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); }
.pm-card:hover { box-shadow: 0 4px 14px rgba(16, 24, 40, .1); }
.pm-card.dragging { opacity: .45; }
.pm-card.is-done .pm-card-t { color: var(--ink-2); }
.pm-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.pm-card-top small { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-card-top .pm-dot { display: none; }
.pm-card-t { display: block; font-size: 13.5px; font-weight: 550; line-height: 1.35; }
.pm-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.pm-more { border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 12px; padding: 6px; cursor: pointer; }
.pm-more:hover { color: var(--ink); }

/* ── уақыт сызығы ── */
.pm-tl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 10px; }
.pm-tl-tools .pm-hint { margin: 0; }
.pm-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.pm-legend i { display: inline-block; width: 14px; height: 8px; border-radius: 3px; margin-left: 6px; }
.lg-done { background: #8fb9a1; } .lg-doing { background: var(--violet); } .lg-plan { background: transparent; border: 1.5px dashed var(--ink-3); }
.pm-tl { padding: 0; overflow: hidden; }
.pm-tl-head { position: relative; height: 34px; margin-left: 200px; border-bottom: 1px solid var(--line); }
.pm-tl-head span small { margin-left: 4px; color: var(--ink-3); font-size: 11px; }
.pm-tl-head span { position: absolute; top: 0; height: 100%; display: flex; align-items: center; padding-left: 8px;
  font-size: 12px; color: var(--ink-2); border-left: 1px solid var(--line); box-sizing: border-box; white-space: nowrap; overflow: hidden; }
.pm-tl-body { position: relative; padding: 4px 0 10px; }
/* Линии месяцев и «сегодня» — слоем над полосой дат, правее подписей. */
.pm-tl-lines { position: absolute; top: 0; bottom: 0; left: 200px; right: 0; pointer-events: none; }
.pm-tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--low); opacity: .55; z-index: 2; }
.pm-tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.pm-tl-group { display: grid; grid-template-columns: 200px minmax(0, 1fr); border-top: 1px solid var(--line-2); }
.pm-tl-group:first-of-type { border-top: 0; }
.pm-tl-label { display: flex; align-items: flex-start; gap: 7px; padding: 10px 12px; font-size: 13px; position: relative; z-index: 3; background: var(--surface); }
.pm-tl-label b { font-weight: 600; line-height: 1.3; }
.pm-tl-label .pm-dot { margin-top: 5px; }
.pm-tl-label small { margin-left: auto; color: var(--ink-3); }
.pm-tl-rows { padding: 6px 0; }
.pm-tl-row { position: relative; height: 24px; }
.pm-tl-bar { position: absolute; top: 3px; height: 18px; padding: 0 6px; border-radius: 6px; border: 0; cursor: pointer;
  font: inherit; font-size: 11px; color: #fff; text-align: left; overflow: hidden; white-space: nowrap; z-index: 1;
  background: var(--c); transition: filter .15s; }
.pm-tl-bar span { display: block; overflow: hidden; text-overflow: ellipsis; }
.pm-tl-bar:hover { filter: brightness(1.08); z-index: 4; }
/* Узкая полоса — подпись справа от неё, тёмным по белому. */
.pm-tl-bar.out { overflow: visible; padding: 0; }
.pm-tl-bar.out span { position: absolute; left: calc(100% + 5px); top: 0; line-height: 18px; color: var(--ink-2); overflow: visible; }
.pm-tl-bar.out:hover span { color: var(--ink); }
.pm-tl-bar.s-done { opacity: .55; }
.pm-tl-bar.s-doing { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--violet); }
.pm-tl-bar.s-next, .pm-tl-bar.s-backlog, .pm-tl-bar.s-idea { background: color-mix(in srgb, var(--c) 14%, white);
  color: var(--ink); border: 1.5px dashed var(--c); }
.pm-tl-bar.late { box-shadow: 0 0 0 2px var(--low); }

/* ── тізім ── */
.pm-table-wrap { padding: 0; overflow-x: auto; }
.pm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pm-table th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 500; border-bottom: 1px solid var(--line); padding: 0; }
.pm-table th button { border: 0; background: transparent; font: inherit; font-size: 12px; color: var(--ink-3); padding: 10px 12px; cursor: pointer; white-space: nowrap; }
.pm-table th button.on { color: var(--ink); font-weight: 600; }
.pm-table td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
.pm-table td:first-child { white-space: normal; min-width: 260px; }
.pm-table td .pm-dot { margin-right: 6px; }
.pm-table td.c { text-align: center; color: var(--ink-2); letter-spacing: -1px; }
.pm-table tr.late td { background: #fff8f7; }
.pm-table select { border: 1px solid transparent; background: transparent; font: inherit; font-size: 12.5px; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
.pm-table select:hover { border-color: var(--line); }
.pm-link { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 550; text-align: left; cursor: pointer; color: var(--ink); }
.pm-link:hover { color: var(--green-dark); }
.pm-tags { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ── матрица ── */
.pm-mx { position: relative; padding: 18px 18px 14px 34px; margin-bottom: 14px; }
.pm-mx-y { position: absolute; left: 6px; top: 50%; transform: rotate(-90deg) translateX(50%); transform-origin: left top; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.pm-mx-grid { display: grid; grid-template-columns: 22px repeat(4, minmax(0, 1fr)); gap: 4px; }
.pm-mx-yl { display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ink-3); }
.pm-mx-cell { min-height: 74px; padding: 6px; border-radius: 10px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; transition: outline .1s; }
.pm-mx-cell.over, .pm-mx-free.over { outline: 2px dashed var(--green); }
.q-win { background: #eaf6ef; } .q-bet { background: #eef1fa; } .q-fill { background: #f6f6f4; } .q-sink { background: #fcf1ef; }
.pm-mx-xl { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-2); padding-top: 4px; }
.pm-mx-xl small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11px; }
.pm-mx-x { text-align: right; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.pm-mx-key { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pm-mx-key span { font-size: 12px; padding: 3px 10px; border-radius: 8px; color: var(--ink-2); }
.pm-chip { max-width: 100%; padding: 4px 8px 4px 9px; border-radius: 8px; border: 1px solid var(--line); border-left: 3px solid var(--c);
  background: var(--surface); font: inherit; font-size: 11.5px; line-height: 1.3; text-align: left; cursor: grab;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-chip.s-doing { box-shadow: 0 0 0 1.5px var(--violet); }
.pm-chip.s-next { font-weight: 600; }
.pm-chip.dragging { opacity: .4; }
.pm-mx-free { display: flex; flex-wrap: wrap; gap: 5px; min-height: 40px; padding: 4px; border-radius: 10px; }

/* ── бағыттар ── */
.pm-dirs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pm-dir { position: relative; padding: 18px 18px 14px; border-top: 4px solid var(--c); }
.pm-dir header { display: flex; align-items: center; gap: 8px; }
.pm-dir header h2 { flex: 1; }
.pm-mini { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font: inherit; font-size: 12px; padding: 4px 9px; cursor: pointer; color: var(--ink-2); }
.pm-dir-goal { margin: 4px 0 12px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.pm-dir-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.pm-dir-bar i { display: block; height: 100%; background: var(--c); border-radius: 3px; }
.pm-dir-n { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 6px; font-size: 12px; color: var(--ink-2); }
.pm-dir-n b { color: var(--ink); font-size: 14px; }
.pm-dir h3 { margin: 12px 0 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.pm-add-in { margin-top: 10px; border: 0; background: transparent; color: var(--green-dark); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 0; }
.pm-dir-new { display: flex; align-items: center; justify-content: center; min-height: 140px; border: 1.5px dashed var(--line);
  border-top: 1.5px dashed var(--line); background: transparent; color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; }
.pm-dir-new:hover { border-color: var(--green); color: var(--green-dark); }

/* ── карточка задачи: боковой лист ── */
.pm-sheet { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(520px, 100vw); padding: 0; border: 0;
  background: var(--surface); color: var(--ink); box-shadow: -18px 0 50px rgba(16, 24, 40, .16); }
.pm-sheet[open] { animation: pm-in .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes pm-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-sheet::backdrop { background: rgba(16, 24, 40, .28); }
.pm-sheet form { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 24px; min-height: 100%; box-sizing: border-box; }
.pm-sheet-s { height: auto; max-height: 100dvh; }
.pm-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.pm-sheet-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.pm-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-2); cursor: pointer; color: var(--ink-2); }
.pm-f { display: flex; flex-direction: column; gap: 6px; }
.pm-f > span { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.pm-f > span em { font-style: normal; color: var(--ink-3); font-weight: 400; }
.pm-f input[type=text], .pm-f input[type=date], .pm-f textarea, .pm-f select {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 14px; background: var(--surface); color: var(--ink); }
.pm-f textarea { resize: vertical; line-height: 1.45; }
.pm-f input:focus, .pm-f textarea:focus, .pm-f select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
#fTitle { font-size: 16px; font-weight: 600; }
.pm-f input[type=color] { width: 60px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); }
.pm-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pm-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pm-seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.pm-seg button { flex: 1 1 auto; border: 0; background: transparent; font: inherit; font-size: 12.5px; padding: 6px 8px; border-radius: 7px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.pm-seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.pm-seg.sm button { padding: 4px 10px; }
.pm-sheet-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; }
.pm-del { margin-left: auto; border: 0; background: transparent; color: var(--low); font: inherit; font-size: 13px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.pm-del:hover { background: var(--low-bg); }
.pm-msg { font-size: 12.5px; color: var(--low); }

@media (max-width: 1100px) {
  .pm-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pm-ov { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .pm-head { align-items: flex-start; flex-direction: column; }
  .pm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-tl-head { margin-left: 120px; }
  .pm-tl-lines { left: 120px; }
  .pm-tl-group { grid-template-columns: 120px minmax(0, 1fr); }
  .pm-row3 { grid-template-columns: 1fr 1fr; }
  .pm-mx { padding-left: 26px; }
}
@media (prefers-reduced-motion: reduce) { .pm-sheet[open] { animation: none; } }
