/* SMM-отдел — оформление
   Фон серый с мягким градиентом. Карточки: Лера — приглушённый бордовый
   с прозрачностью, Алекс — тёмно-серый. Подписи исполнителей строчными. */

:root {
  --bg:         #d8d5d1;
  --bg-2:       #c9c5c0;
  --surface:    #f4f2ef;
  --surface-2:  #ebe8e4;
  --ink:        #241f1d;
  --muted:      #6d6862;
  --line:       rgba(36, 31, 29, .12);

  --lera:       #7a2333;
  --lera-fill:  rgba(122, 35, 51, .17);
  --lera-line:  rgba(122, 35, 51, .34);
  --alex:       #383c43;
  --alex-fill:  #383c43;
  --alex-ink:   #e8e5e1;

  --high:       #b4442c;
  --ok:         #3f6f55;

  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgba(30,25,22,.08), 0 6px 18px rgba(30,25,22,.07);
  --tabbar-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 700px at 12% -8%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(900px 600px at 110% 8%, rgba(122,35,51,.10), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ─────────── вход ─────────── */

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login__box {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 28px 22px 22px;
}
.login__logo { font-size: 23px; font-weight: 700; letter-spacing: -.01em; }
.login__sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login__error { color: var(--high); font-size: 13px; min-height: 18px; margin: 2px 0 8px; }

/* ─────────── общее ─────────── */

.field { display: block; margin-bottom: 14px; }
.field__label {
  display: block; font-size: 12px; color: var(--muted);
  margin-bottom: 5px; letter-spacing: .01em;
}
input[type=text], input[type=password], input[type=date], input[type=month],
textarea, select {
  width: 100%;
  font: inherit;
  font-size: 16px;              /* iOS не зумит поля от 16px */
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  outline: none;
  appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--lera-line); }
textarea { min-height: 78px; resize: vertical; line-height: 1.4; }
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%236d6862' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.btn {
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: filter .15s, transform .06s;
}
.btn:active { transform: scale(.985); }
.btn--primary { background: var(--lera); border-color: var(--lera); color: #fff; font-weight: 600; }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--high); }
.btn--wide { width: 100%; padding: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ─────────── шапка ─────────── */

.app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  background: rgba(216,213,209,.86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__row { display: flex; align-items: center; gap: 10px; }
.topbar__row--filters { margin-top: 8px; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.who {
  border: none; background: var(--surface); color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow);
}

.chips { display: flex; gap: 6px; flex: 1; min-width: 0; }
.chip {
  font: inherit; font-size: 13px;
  border: 1px solid var(--line); background: rgba(255,255,255,.5);
  color: var(--muted);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; white-space: nowrap;
}
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.is-active[data-who="lera"] { background: var(--lera); border-color: var(--lera); }
.chip.is-active[data-who="alex"] { background: var(--alex); border-color: var(--alex); }
.select--project { width: auto; max-width: 46%; font-size: 13px; padding: 6px 28px 6px 10px; background-color: rgba(255,255,255,.5); }

.tabs--desktop { display: none; gap: 4px; }
.tabs--desktop .tab {
  font: inherit; font-size: 14px; border: none; background: transparent;
  color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.tabs--desktop .tab.is-active { background: var(--surface); color: var(--ink); font-weight: 600; }

/* ─────────── контент ─────────── */

.main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 12px calc(var(--tabbar-h) + 78px);
}

.head { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 12px; }
.head h1 { font-size: 21px; margin: 0; letter-spacing: -.01em; }
.head__date { color: var(--muted); font-size: 13px; }

.progress { margin-bottom: 14px; }
.progress__row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.progress__bar { height: 6px; border-radius: 999px; background: rgba(36,31,29,.10); overflow: hidden; }
.progress__fill { height: 100%; background: var(--lera); border-radius: 999px; transition: width .3s; }

.group { margin-bottom: 20px; }
.group__title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 0 2px 8px;
}
.group__title .count { color: var(--muted); opacity: .8; }
.group--overdue .group__title { color: var(--high); }

.empty {
  text-align: center; color: var(--muted); font-size: 14px;
  padding: 34px 16px; background: rgba(255,255,255,.35);
  border: 1px dashed var(--line); border-radius: var(--r-md);
}

/* ─────────── карточка задачи ─────────── */

.card {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  transition: opacity .2s, transform .06s;
}
.card:active { transform: scale(.994); }
.card--lera { background: var(--lera-fill); border-color: var(--lera-line); color: var(--ink); }
.card--alex { background: var(--alex-fill); border-color: #2b2f35; color: var(--alex-ink); }
.card--high { box-shadow: var(--shadow), inset 3px 0 0 var(--high); }
.card--done { opacity: .48; }
.card--done .card__title { text-decoration: line-through; }

.card__check {
  flex: none; width: 22px; height: 22px; margin-top: 1px;
  border-radius: 50%; border: 1.8px solid currentColor; opacity: .55;
  background: transparent; cursor: pointer; padding: 0;
  display: grid; place-items: center;
}
.card__check:hover { opacity: .9; }
.card__check.is-done { opacity: 1; background: currentColor; }
.card__check svg { width: 12px; height: 12px; display: none; }
.card__check.is-done svg { display: block; }
.card--lera .card__check.is-done svg { color: var(--lera-fill); }
.card--alex .card__check.is-done svg { color: var(--alex-fill); }

.card__body { flex: 1; min-width: 0; }
.card__title { font-size: 15px; line-height: 1.35; word-break: break-word; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 5px; font-size: 12px; opacity: .82; }
.card__who { font-size: 12px; letter-spacing: .02em; text-transform: lowercase; opacity: .95; font-weight: 600; }
.card__project { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.card__due.is-late { color: var(--high); font-weight: 600; opacity: 1; }
.card--alex .card__due.is-late { color: #ff9b84; }
.card__flag { color: var(--high); font-weight: 700; }
.card--alex .card__flag { color: #ff9b84; }

/* ─────────── доска ─────────── */

.board { display: grid; gap: 12px; grid-template-columns: 1fr; align-items: start; }
.column {
  background: rgba(255,255,255,.42);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px;
}
.column__head {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none; margin-bottom: 8px;
}
.column__name { font-weight: 600; font-size: 15px; flex: 1; }
.column__count { font-size: 12px; color: var(--muted); }
.column__caret { color: var(--muted); font-size: 12px; transition: transform .15s; }
.column.is-collapsed .column__caret { transform: rotate(-90deg); }
.column.is-collapsed .column__body { display: none; }
.column__body .card:last-child { margin-bottom: 0; }
.switcher { display: flex; gap: 6px; margin-bottom: 12px; }

/* ─────────── календарь ─────────── */

.cal__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal__title { font-weight: 600; flex: 1; }
.cal__nav { display: flex; gap: 6px; }
.cal__nav .btn { padding: 6px 11px; }

.cal__weekdays, .cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal__weekdays { margin-bottom: 4px; }
.cal__wd { text-align: center; font-size: 11px; color: var(--muted); text-transform: lowercase; }
.cal__day {
  min-height: 74px; padding: 4px;
  background: rgba(255,255,255,.42);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer; overflow: hidden;
}
.cal__day.is-out { opacity: .42; }
.cal__day.is-today { border-color: var(--lera); box-shadow: inset 0 0 0 1px var(--lera); }
.cal__day.is-drop { background: rgba(122,35,51,.14); border-color: var(--lera); }
.cal__daynum { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.cal__day.is-today .cal__daynum { color: var(--lera); font-weight: 700; }
.cal__pill {
  font-size: 10.5px; line-height: 1.25; border-radius: 5px;
  padding: 2px 4px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid transparent;
}
.cal__pill--lera { background: var(--lera-fill); border-left-color: var(--lera); color: var(--ink); }
.cal__pill--alex { background: rgba(56,60,67,.85); border-left-color: #90959d; color: var(--alex-ink); }
.cal__pill--done { opacity: .45; text-decoration: line-through; }
.cal__more { font-size: 10px; color: var(--muted); padding-left: 2px; }

.cal__dots { display: flex; flex-wrap: wrap; gap: 3px; padding: 1px 1px 0; }
.cal__dot { width: 8px; height: 8px; border-radius: 50%; display: block; }
.cal__dot--lera { background: var(--lera); }
.cal__dot--alex { background: var(--alex); }
.cal__dot.is-done { opacity: .3; }

.week { display: grid; gap: 8px; }
.week__day {
  background: rgba(255,255,255,.42); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px;
}
.week__day.is-today { border-color: var(--lera); }
.week__title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.week__day.is-today .week__title { color: var(--lera); font-weight: 600; }

/* ─────────── цели ─────────── */

.goal {
  display: flex; align-items: flex-start; gap: 11px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px; margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.goal__check {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 6px;
  border: 1.8px solid rgba(36,31,29,.35); background: transparent;
  cursor: pointer; padding: 0; display: grid; place-items: center;
}
.goal__check.is-done { background: var(--ok); border-color: var(--ok); color: #fff; }
.goal__check svg { width: 12px; height: 12px; display: none; }
.goal__check.is-done svg { display: block; }
.goal__text { flex: 1; }
.goal.is-done .goal__text { text-decoration: line-through; opacity: .55; }
.goal__meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.goal__del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; padding: 2px 4px; }

.addrow { display: flex; gap: 8px; margin-bottom: 14px; }
.addrow input { flex: 1; }

/* ─────────── кнопка «плюс» и таббар ─────────── */

.fab {
  position: fixed; right: 16px;
  bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--lera); color: #fff; border: none;
  font-size: 30px; line-height: 1; cursor: pointer; z-index: 30;
  box-shadow: 0 6px 20px rgba(122,35,51,.38);
}
.fab:active { transform: scale(.95); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(244,242,239,.94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar .tab {
  flex: 1; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 11px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.tabbar .tab.is-active { color: var(--lera); font-weight: 600; }
.tabbar .tab svg { width: 21px; height: 21px; }

/* ─────────── шторка ─────────── */

.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(28,24,22,.45); animation: fade .18s ease; }
.sheet {
  position: relative; width: 100%; max-height: 92dvh; overflow-y: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(28,24,22,.25);
  animation: up .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes up { from { transform: translateY(18px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

.sheet__grip { width: 38px; height: 4px; border-radius: 999px; background: rgba(36,31,29,.18); margin: -6px auto 12px; }
.sheet__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet__head h2 { font-size: 17px; margin: 0; flex: 1; }
.sheet__close { border: none; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.sheet__error { color: var(--high); font-size: 13px; min-height: 18px; }
.sheet__actions { display: flex; gap: 8px; margin-top: 6px; }
.sheet__actions .btn { flex: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; font: inherit; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: var(--r-sm); padding: 10px;
}
.seg button.is-active[data-val="lera"], .seg button.is-active[data-who="lera"] {
  background: var(--lera-fill); border-color: var(--lera); color: var(--ink); font-weight: 600;
}
.seg button.is-active[data-val="alex"], .seg button.is-active[data-who="alex"] {
  background: var(--alex-fill); border-color: var(--alex); color: #fff; font-weight: 600;
}
.seg button.is-active[data-val="high"] { background: rgba(180,68,44,.14); border-color: var(--high); color: var(--ink); font-weight: 600; }
.seg button.is-active[data-val="normal"] { background: var(--surface-2); border-color: var(--muted); color: var(--ink); font-weight: 600; }

.comments { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.comments__title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.comment { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 7px; font-size: 14px; }
.comment__meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; display: flex; gap: 8px; }
.comment__del { margin-left: auto; border: none; background: none; color: var(--muted); cursor: pointer; padding: 0; }

.projects-admin { margin-top: 4px; }
.padmin { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.padmin__name { flex: 1; font-size: 14px; }
.padmin__name.is-arch { color: var(--muted); text-decoration: line-through; }
.padmin .btn { padding: 5px 9px; font-size: 12px; }

/* ─────────── тост ─────────── */

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 88px);
  background: rgba(36,31,29,.94); color: #fff;
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px;
  z-index: 60; animation: fade .18s ease; max-width: 88vw; text-align: center;
}

/* ─────────── десктоп ─────────── */

@media (min-width: 900px) {
  body { font-size: 15px; }
  .tabs--desktop { display: flex; }
  .tabbar { display: none; }
  .main { padding: 22px 20px 60px; }
  .topbar { padding: 12px 20px 10px; }
  .topbar__row--filters { margin-top: 10px; }
  .select--project { max-width: 240px; }
  .fab { bottom: 26px; right: 26px; }
  .toast { bottom: 32px; }
  /* списки в одну колонку не растягиваем на всю ширину — так читается лучше */
  #view-today, #view-goals { max-width: 880px; }
  .board { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
  .cal__day { min-height: 104px; }
  .cal__pill { font-size: 11.5px; }
  .sheet-wrap { align-items: center; justify-content: center; }
  .sheet {
    width: min(560px, 94vw); max-height: 88vh;
    border-radius: var(--r-lg); padding: 20px;
    animation: pop .18s cubic-bezier(.2,.8,.3,1);
  }
  .sheet__grip { display: none; }
  @keyframes pop { from { transform: scale(.97); opacity: .5; } }
  .week { grid-template-columns: repeat(7, 1fr); }
}

@media (min-width: 1280px) {
  .board { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}
