/* Штаб запуска Эссенс — палитра снята с лендинга gramota.ai */
:root {
  --ink: #14102A;
  --ink-2: #2C2450;
  --text: #241D45;
  --muted: #5E5576;
  --whisper: #8E86A6;
  --line: #E4E0EC;
  --line-soft: #EFECF4;
  --bg: #F7F5FA;
  --card: #FFFFFF;
  --rose: #C13C8C;
  --rose-soft: #FDEBF5;
  --lilac: #7C5CC5;
  --lilac-soft: #F0EAFB;
  --sky: #4FA6CC;
  --sky-soft: #E6F4FA;
  --gold: #C9925A;
  --gold-soft: #FBF1E4;
  --green: #2E9E6B;
  --green-soft: #E6F6EF;
  --red: #D64550;
  --red-soft: #FDECEE;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 16, 42, .05), 0 8px 24px rgba(20, 16, 42, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--lilac); }

/* ── шапка ───────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; height: 58px;
  background: var(--ink);
  color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 9px; font-weight: 700; letter-spacing: .2px; }
.brand small { font-weight: 500; opacity: .55; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; }
.tabs { display: flex; gap: 4px; margin-left: 10px; flex: 1; overflow-x: auto; }
.tabs button {
  background: none; border: 0; color: rgba(255,255,255,.62);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: #fff; background: rgba(255,255,255,.08); }
.tabs button.on { color: var(--ink); background: #fff; font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.7); }
.who button {
  background: rgba(255,255,255,.1); border: 0; color: #fff;
  padding: 6px 11px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.who button:hover { background: rgba(255,255,255,.2); }

/* ── общий каркас ───────────────────────────────────────────────── */
.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 20px 80px; }
.page { display: none; }
.page.on { display: block; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 26px 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 0 16px;
}
.bar .spacer { flex: 1; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13px;
}
.chip:hover { border-color: var(--lilac); color: var(--lilac); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { opacity: .6; margin-left: 5px; font-size: 12px; }
select, input[type=text], input[type=date], input[type=search], textarea {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 7px 10px; outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--lilac); box-shadow: 0 0 0 3px var(--lilac-soft); }
.btn {
  background: var(--rose); color: #fff; border: 0; border-radius: 10px;
  padding: 9px 16px; cursor: pointer; font-weight: 600;
}
.btn:hover { background: #a83279; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn.ghost:hover { border-color: var(--lilac); color: var(--lilac); }
.btn.sm { padding: 6px 11px; font-size: 13px; }

/* ── список задач ───────────────────────────────────────────────── */
.group { margin-bottom: 22px; }
.group > h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--whisper); margin: 0 0 8px; display: flex; align-items: center; gap: 8px;
}
.group > h3 .cnt { color: var(--line); }
.rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 26px 1fr 116px 104px 92px 26px;
  align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: #FBFAFD; }
.row.done .ttl { color: var(--whisper); text-decoration: line-through; }
.tick {
  width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; display: grid; place-items: center; padding: 0;
  color: transparent; font-size: 11px; line-height: 1;
}
.tick:hover { border-color: var(--green); color: var(--green); }
.row.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.ttl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ttl span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { font-size: 11px; color: var(--whisper); font-variant-numeric: tabular-nums; }
.cmt { font-size: 11px; color: var(--whisper); }
.who-pill, .pill {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent; display: inline-block;
}
.who-pill { background: var(--lilac-soft); color: var(--lilac); }
.who-pill[data-w="Настя"] { background: var(--sky-soft); color: var(--sky); }
.who-pill[data-w="Клод"] { background: var(--gold-soft); color: var(--gold); }
.who-pill[data-w="вместе"] { background: var(--rose-soft); color: var(--rose); }
.who-pill[data-w=""] { background: var(--line-soft); color: var(--whisper); }
.due { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.due.soon { color: var(--gold); font-weight: 600; }
.due.late { color: var(--red); font-weight: 600; }
.prio { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.prio.критично { background: var(--red); }
.prio.важно { background: var(--gold); }
.prio.потом { background: var(--line); }
.st { font-size: 12px; color: var(--muted); }
.st[data-s="в работе"] { color: var(--sky); font-weight: 600; }
.st[data-s="ждёт"] { color: var(--gold); }
.st[data-s="готово"] { color: var(--green); }

/* подзадачи: шаг внутри крупной задачи */
.row.sub { background: #FCFBFE; }
.row.sub .ttl { padding-left: 22px; position: relative; }
.row.sub .ttl::before {
  content: ''; position: absolute; left: 8px; top: 50%; width: 8px; height: 1px; background: var(--line);
}
.row.sub .t { font-size: 14px; color: var(--muted); }
.row.sub.done .t { color: var(--whisper); }
.kids {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; font-size: 11px; padding: 2px 8px; cursor: pointer; white-space: nowrap;
}
.kids:hover { border-color: var(--lilac); color: var(--lilac); }
.kids.on { background: var(--lilac-soft); border-color: var(--lilac-soft); color: var(--lilac); }
.subs { margin-top: 6px; }
.subs .s-item {
  display: flex; align-items: center; gap: 9px; padding: 6px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.subs .s-item:last-child { border-bottom: 0; }
.subs .s-item.done span.st { color: var(--whisper); text-decoration: line-through; }
.subs .s-item .who-pill { margin-left: auto; }

.addrow {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  color: var(--whisper); cursor: pointer; border-top: 1px solid var(--line-soft);
}
.addrow:hover { color: var(--rose); background: #FDF9FC; }

/* строка быстрого ввода задачи — встаёт на место «+ Добавить задачу» */
.addform {
  display: grid; gap: 8px; align-items: center;
  grid-template-columns: 1fr 118px 116px 138px 150px auto auto;
  padding: 10px 12px; border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #FDF9FC, #fff);
}
.addform input, .addform select { width: 100%; font-size: 14px; }
.addform #afTitle { font-weight: 600; }
.addform .btn { white-space: nowrap; }
@media (max-width: 860px) {
  .addform { grid-template-columns: 1fr 1fr; }
  .addform #afTitle { grid-column: 1 / -1; }
}

/* ── контент-план ───────────────────────────────────────────────── */
.viewtabs { display: inline-flex; background: #EFECF4; border-radius: 10px; padding: 3px; gap: 2px; }
.viewtabs button {
  border: 0; background: none; color: var(--muted); font-size: 13px;
  padding: 6px 14px; border-radius: 8px; cursor: pointer;
}
.viewtabs button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20,16,42,.08); }
.hint { font-size: 12px; color: var(--whisper); }

.panel-flat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto;
}
table.ptable { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 900px; }
table.ptable thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--whisper); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.ptable td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.ptable tbody tr { cursor: pointer; }
table.ptable tbody tr:hover td { background: #FBFAFD; }
table.ptable tbody tr.sel td { background: var(--lilac-soft); }
table.ptable tr.qadd td { background: #FDF9FC; border-bottom: 1px solid var(--line); }
table.ptable tr.qadd:hover td { background: #FDF9FC; }
.cell-inp, .cell-sel {
  border: 1px solid transparent; border-radius: 8px; padding: 6px 7px;
  font-size: 13px; background: transparent; width: 100%; max-width: 100%;
}
.cell-inp.wide { font-weight: 600; }
.cell-inp:hover, .cell-sel:hover { border-color: var(--line); background: #fff; }
.cell-inp:focus, .cell-sel:focus { border-color: var(--lilac); background: #fff; box-shadow: 0 0 0 3px var(--lilac-soft); }
.cell-sel.st-sel { font-weight: 600; border-radius: 999px; font-size: 12px; padding: 5px 9px; }
.cell-sel.s-idea { background: var(--line-soft); color: var(--muted); }
.cell-sel.s-work { background: var(--lilac-soft); color: var(--lilac); }
.cell-sel.s-approve { background: var(--gold-soft); color: var(--gold); }
.cell-sel.s-approved { background: var(--sky-soft); color: var(--sky); }
.cell-sel.s-design { background: var(--rose-soft); color: var(--rose); }
.cell-sel.s-planned { background: var(--sky-soft); color: var(--sky-deep, var(--sky)); }
.cell-sel.s-published { background: var(--green-soft); color: var(--green); }
.fmt { display: inline-flex; align-items: center; gap: 6px; width: 100%; }
.fmt .fi {
  width: 24px; height: 24px; border-radius: 7px; background: var(--bg);
  display: grid; place-items: center; font-size: 12px; flex: none;
}
.row-del { border: 0; background: none; cursor: pointer; opacity: .35; font-size: 14px; }
.row-del:hover { opacity: 1; }

.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-head b { font-size: 15px; text-transform: capitalize; }
.cal-head .spacer { flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--whisper); padding: 2px 4px; }
.cal-day {
  min-height: 92px; border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 6px; background: #fff;
}
.cal-day.other { background: var(--bg); border-color: transparent; }
.cal-day.today { border-color: var(--rose); background: #FFFBFD; }
.cal-day.drop { border-color: var(--lilac); background: var(--lilac-soft); }
.cal-day .dnum { font-size: 12px; color: var(--whisper); margin-bottom: 4px; }
.cal-day.today .dnum { color: var(--rose); font-weight: 700; }
.cal-mile {
  font-size: 11px; color: var(--rose); background: var(--rose-soft);
  border-radius: 6px; padding: 2px 6px; margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-item {
  font-size: 12px; background: var(--lilac-soft); color: var(--ink-2, var(--text));
  border-radius: 7px; padding: 4px 7px; margin-bottom: 4px; cursor: grab;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-item:hover { background: #E3D9F8; }
@media (max-width: 860px) {
  .cal-grid { grid-template-columns: repeat(7, minmax(46px, 1fr)); font-size: 11px; }
  .cal-day { min-height: 62px; padding: 4px; }
}

/* ── доска ──────────────────────────────────────────────────────── */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; }
.col { background: #F1EEF7; border-radius: var(--radius); padding: 12px; min-height: 160px; }
.col.over { background: var(--lilac-soft); outline: 2px dashed var(--lilac); }
.col h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.card {
  background: #fff; border-radius: 11px; padding: 11px 12px; margin-bottom: 9px;
  box-shadow: 0 1px 2px rgba(20,16,42,.06); cursor: grab; border: 1px solid transparent;
}
.card:hover { border-color: var(--lilac); }
.card .t { font-size: 14px; margin-bottom: 7px; }
.card .meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* ── карточка задачи (панель справа) ────────────────────────────── */
.veil { position: fixed; inset: 0; background: rgba(20,16,42,.35); z-index: 60; display: none; }
.veil.on { display: block; }
.pane {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: #fff; z-index: 61; box-shadow: -8px 0 40px rgba(20,16,42,.18);
  display: none; flex-direction: column;
}
.pane.on { display: flex; }
.pane header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.pane header .code { font-size: 12px; }
.pane header .x { margin-left: auto; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--whisper); }
.pane .body { flex: 1; overflow: auto; padding: 18px; }
.pane .ttlinput {
  width: 100%; border: 1px solid transparent; border-radius: 9px; padding: 8px 10px;
  font-size: 18px; font-weight: 600; margin-bottom: 14px; background: transparent;
}
.pane .ttlinput:hover { border-color: var(--line); }
.fields { display: grid; grid-template-columns: 96px 1fr; gap: 10px 12px; align-items: center; margin-bottom: 18px; }
.fields label { color: var(--muted); font-size: 13px; }
.fields select, .fields input { width: 100%; }
.pane textarea { width: 100%; min-height: 96px; resize: vertical; }
.cmts { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.cmt-item { margin-bottom: 12px; }
.cmt-item .h { font-size: 12px; color: var(--whisper); margin-bottom: 3px; }
.cmt-item .b { background: var(--bg); border-radius: 10px; padding: 9px 12px; white-space: pre-wrap; }
.pane footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; }

/* ── дашборд и документы ───────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.tile .k { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--whisper); margin-bottom: 7px; }
.tile .v { font-size: 27px; font-weight: 700; letter-spacing: -.5px; }
.tile .v small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.tile .d { font-size: 12px; color: var(--muted); margin-top: 5px; }
.tile.hot { border-color: var(--rose); background: linear-gradient(180deg, #fff, var(--rose-soft)); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--whisper); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--line);
}
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.past td { color: var(--whisper); }
table.grid tr.next td { background: var(--rose-soft); }
.progress { height: 7px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--lilac); border-radius: 999px; }
.blockline { display: grid; grid-template-columns: 1fr 130px 60px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.blockline:last-child { border-bottom: 0; }
.blockline .nm { font-size: 14px; }
.blockline .nm b { font-weight: 600; }
.blockline .cnt { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.note { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.note h4 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.note .txt { white-space: pre-wrap; color: var(--text); }
.note .acts { margin-top: 8px; display: flex; gap: 6px; }
.empty { color: var(--whisper); padding: 22px; text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 11px;
  box-shadow: var(--shadow); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.on { opacity: 1; }
.toast.act { pointer-events: auto; }

@media (max-width: 860px) {
  .row { grid-template-columns: 24px 1fr 84px 26px; }
  .row .st, .row .due { display: none; }
  .board { grid-template-columns: 1fr; }
  .wrap { padding: 16px 12px 70px; }
  .fields { grid-template-columns: 1fr; gap: 6px; }
  .fields label { margin-top: 6px; }
}
