/* Team Mini App. Design: canvas "Personal OS" → page «Команда · Mini App» (dark, lime accent, Onest).
 * Follows the Telegram theme: dark by default, light tokens when the user's Telegram is light. */
@font-face { font-family: Onest; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/tg/fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/tg/fonts/onest-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #0A0B0D; --card: #15171B; --inset: #0F1013; --seg-on: #2A2D34; --sheet: #17191D;
  --line: rgba(255, 255, 255, 0.06); --line-2: rgba(255, 255, 255, 0.12); --chip: rgba(255, 255, 255, 0.07);
  --text: #F2F3F5; --text-2: #C9CDD3; --muted: #9AA0A8; --faint: #8A9098; --ic-bg: rgba(255, 255, 255, 0.08);
  --lime: #C6F36B; --on-lime: #0A0B0D; --lime-soft: rgba(198, 243, 107, 0.14);
  --s-new-bg: transparent; --s-new: #C9CDD3; --s-new-line: rgba(255, 255, 255, 0.28);
  --s-work-bg: rgba(108, 140, 255, 0.16); --s-work: #A9BCFF;
  --s-review-bg: rgba(245, 184, 75, 0.14); --s-review: #F7C873;
  --s-done-bg: rgba(126, 224, 138, 0.14); --s-done: #93E89D;
  --s-bad-bg: rgba(255, 107, 94, 0.14); --s-bad: #FF9387; --s-bad-line: rgba(255, 107, 94, 0.28);
  --amber: #F5B84B; --green: #7EE08A; --client-bg: rgba(124, 200, 255, 0.14); --client: #9FD6FF;
  --glow: rgba(147, 232, 157, 0.16);
  --nav-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F3F4F6; --card: #FFFFFF; --inset: #EEF0F3; --seg-on: #FFFFFF; --sheet: #FFFFFF;
  --line: rgba(10, 11, 13, 0.08); --line-2: rgba(10, 11, 13, 0.14); --chip: rgba(10, 11, 13, 0.06);
  --text: #121418; --text-2: #3A3F47; --muted: #5E646D; --faint: #6A7079; --ic-bg: rgba(10, 11, 13, 0.06);
  --lime: #4E7A00; --on-lime: #FFFFFF; --lime-soft: rgba(78, 122, 0, 0.12);
  --s-new-bg: transparent; --s-new: #3A3F47; --s-new-line: rgba(10, 11, 13, 0.3);
  --s-work-bg: rgba(60, 90, 220, 0.12); --s-work: #2F4FC4;
  --s-review-bg: rgba(200, 130, 0, 0.14); --s-review: #8A5A00;
  --s-done-bg: rgba(30, 150, 60, 0.12); --s-done: #1D7A35;
  --s-bad-bg: rgba(210, 50, 40, 0.1); --s-bad: #B3261E; --s-bad-line: rgba(210, 50, 40, 0.3);
  --amber: #E5A23A; --green: #3CB55A; --client-bg: rgba(30, 120, 200, 0.1); --client: #1F6FB2;
  --glow: rgba(60, 181, 90, 0.12);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 Onest, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; min-height: 100vh; overscroll-behavior-y: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lime); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#bg { position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(100% 38% at 100% 0%, var(--glow) 0%, transparent 65%); }
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; outline: none;
  padding: 20px 16px calc(var(--nav-h) + var(--safe-b) + 28px); display: flex; flex-direction: column; gap: 12px; }
body.with-bar #app { padding-bottom: calc(var(--safe-b) + 96px); }

/* ---- header ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }
.top h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.bar { display: flex; align-items: center; gap: 12px; }
.bar h1 { margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .grow { flex: 1; min-width: 0; }
.round { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: none; background: var(--chip);
  color: var(--text); display: flex; align-items: center; justify-content: center; padding: 0; }
.chip { flex-shrink: 0; height: 28px; padding: 0 10px; border-radius: 14px; background: var(--chip); color: var(--text-2);
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; border: none; }
.chip.bad { background: var(--s-bad-bg); color: var(--s-bad); height: 22px; padding: 0 9px; border-radius: 11px; }
.chip.on { background: var(--lime-soft); color: var(--lime); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips .chip { height: 32px; border-radius: 16px; padding: 0 12px; }

/* ---- segmented ---- */
.seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; padding: 4px; border-radius: 16px;
  background: var(--card); gap: 4px; }
.seg button { height: 36px; border-radius: 12px; border: none; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; padding: 0 4px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--text); font-weight: 600; }
.hint { padding: 0 4px; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 6px; }

/* ---- cards & lists ---- */
.card { padding: 2px 14px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.card.pad { padding: 14px; border-radius: 22px; display: flex; flex-direction: column; gap: 10px; }
.card.bad { border-color: var(--s-bad-line); }
.card-h { font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 0 2px; display: flex;
  justify-content: space-between; align-items: center; }
.card.bad .card-h { color: var(--s-bad); }
.label { font-size: 13px; font-weight: 500; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; font-size: 14px; }
.err { padding: 14px; border-radius: 16px; background: var(--s-bad-bg); color: var(--s-bad); font-size: 14px; }

.row-wrap { position: relative; overflow: hidden; border-top: 1px solid var(--line); margin: 0 -14px; }
.row-wrap:first-of-type, .card-h + .row-wrap { border-top: none; }
.row-acts { position: absolute; right: 0; top: 0; bottom: 0; display: flex; }
.row-acts button { width: 76px; border: none; font-size: 12px; font-weight: 600; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: #0A0B0D; }
.row-acts .later { background: var(--amber); }
.row-acts .ok { background: var(--green); }
.row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card);
  transition: transform .18s ease; touch-action: pan-y; }
.row.dragging { transition: none; }
.row .main { flex: 1; min-width: 0; border: none; background: none; padding: 0; text-align: left; color: var(--text); }
.row .t { display: block; font-size: 15px; font-weight: 500; line-height: 1.35; }
.row .m { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; color: var(--muted); }
.row .m .dot { color: var(--faint); }
.due { font-size: 12px; white-space: nowrap; color: var(--muted); }
.due.bad { color: var(--s-bad); }
.due.soon { color: var(--s-review); }

.st { flex-shrink: 0; height: 32px; padding: 0 10px; border-radius: 16px; border: none; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.st-new { background: var(--s-new-bg); color: var(--s-new); border: 1px dashed var(--s-new-line); }
.st-in_progress { background: var(--s-work-bg); color: var(--s-work); }
.st-review { background: var(--s-review-bg); color: var(--s-review); }
.st-done { background: var(--s-done-bg); color: var(--s-done); }
.st-blocked { background: var(--s-bad-bg); color: var(--s-bad); }
.st-cancelled { background: var(--chip); color: var(--faint); }
span.st { height: 24px; padding: 0 9px; border-radius: 12px; }

.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-height: 44px; width: 100%;
  border: none; border-top: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; }
.item:first-child, .card-h + .item { border-top: none; }
.item .grow { flex: 1; min-width: 0; }
.item .k { display: block; font-size: 12px; color: var(--muted); }
.item .v { display: block; font-size: 15px; font-weight: 500; margin-top: 1px; }
.item .s { display: block; font-size: 12px; color: var(--faint); }
.item .n { font-size: 15px; font-weight: 600; }
.ic { width: 36px; height: 36px; flex-shrink: 0; border-radius: 11px; background: var(--ic-bg); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; }
.ic.client { width: 40px; height: 40px; border-radius: 12px; background: var(--client-bg); color: var(--client); }
.av { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; color: #0A0B0D; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.stat b { display: block; font-size: 24px; font-weight: 700; margin-top: 2px; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.bad b { color: var(--s-bad); }
.stat.warn b { color: var(--s-review); }

/* ---- task card ---- */
.task-title { font-size: 22px; font-weight: 600; line-height: 1.3; padding: 0 4px; overflow-wrap: anywhere; }
.statuses { padding: 4px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.statuses button { height: 36px; border-radius: 12px; border: none; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 500; padding: 0 2px; }
.statuses button:disabled { opacity: .45; cursor: default; }
.statuses button[aria-pressed="true"] { font-weight: 600; opacity: 1; }
.statuses .on-new { background: var(--chip); color: var(--text); }
.statuses .on-in_progress { background: var(--s-work-bg); color: var(--s-work); }
.statuses .on-review { background: var(--s-review-bg); color: var(--s-review); }
.statuses .on-done { background: var(--s-done-bg); color: var(--s-done); }
.banner { padding: 10px 12px; border-radius: 14px; background: var(--chip); color: var(--text-2); font-size: 13px;
  display: flex; gap: 10px; align-items: center; }
.banner.bad { background: var(--s-bad-bg); color: var(--s-bad); }
.desc { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.cm { display: flex; gap: 10px; }
.cm .who { font-size: 13px; }
.cm .who b { font-weight: 600; }
.cm .who span { color: var(--faint); }
.cm .txt { font-size: 14px; line-height: 1.45; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hist { display: flex; gap: 10px; font-size: 13px; line-height: 1.4; }
.hist .when { width: 52px; flex-shrink: 0; color: var(--faint); font-variant-numeric: tabular-nums; }
.hist .what { color: var(--text-2); }

/* ---- input bars ---- */
.field { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border-radius: 24px;
  background: var(--card); border: 1px solid var(--line-2); }
.field input { flex: 1; min-width: 0; height: 44px; border: none; background: transparent; color: var(--text);
  font-size: 15px; outline: none; padding: 0; }
.field input::placeholder, textarea::placeholder { color: var(--faint); }
.dock { position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 70%, transparent); }
.dock > * { max-width: 536px; margin: 0 auto; }
.dock .field { padding-right: 6px; }
.send { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: none; background: var(--lime);
  color: var(--on-lime); display: flex; align-items: center; justify-content: center; padding: 0; }
.send:disabled { opacity: .4; }
.big { width: 100%; height: 52px; border-radius: 26px; border: none; background: var(--lime); color: var(--on-lime);
  font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.big:disabled { opacity: .5; }
.big.ghost { background: var(--chip); color: var(--text); }
.compose { display: block; padding: 14px; border-radius: 20px; background: var(--card);
  border: 1px solid color-mix(in srgb, var(--lime) 35%, transparent); }
.compose textarea { width: 100%; border: none; background: transparent; color: var(--text); font-size: 17px;
  line-height: 1.45; resize: none; outline: none; padding: 0; min-height: 75px; }
.compose .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px;
  color: var(--faint); }
.small { height: 34px; padding: 0 14px; border-radius: 17px; border: none; background: var(--lime-soft); color: var(--lime);
  font-size: 13px; font-weight: 600; flex-shrink: 0; }

/* ---- navigation ---- */
#nav { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b));
  padding: 6px 12px calc(6px + var(--safe-b)); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  align-items: center; background: color-mix(in srgb, var(--bg) 96%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
#nav button { height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: none; background: none; color: var(--faint); font-size: 12px; font-weight: 500; }
#nav button[aria-current="page"] { color: var(--text); font-weight: 600; }
#nav .plus { width: 40px; height: 28px; border-radius: 14px; background: var(--lime); color: var(--on-lime); display: flex;
  align-items: center; justify-content: center; }
body.with-bar #nav { display: none; }

/* ---- sheet ---- */
#sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0.5); }
#sheet .panel { width: 100%; max-width: 560px; max-height: 82vh; overflow: auto; background: var(--sheet);
  border-radius: 24px 24px 0 0; padding: 10px 16px calc(18px + var(--safe-b)); display: flex; flex-direction: column;
  gap: 10px; }
#sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 4px; }
#sheet h2 { margin: 0; font-size: 17px; font-weight: 600; }
#sheet .opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 4px; border: none;
  background: none; color: var(--text); text-align: left; border-top: 1px solid var(--line); font-size: 15px; }
#sheet .opt:first-of-type { border-top: none; }
#sheet .opt .grow { flex: 1; min-width: 0; }
#sheet .opt .s { display: block; font-size: 12px; color: var(--faint); }
#sheet .opt[aria-checked="true"] { color: var(--lime); font-weight: 600; }
#sheet label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
#sheet label.f input, #sheet label.f select { height: 46px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--text); padding: 0 12px; font-size: 15px; }
.row2 { display: flex; gap: 8px; }
.row2 > * { flex: 1; }

#toast { position: fixed; z-index: 30; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }
.skeleton { height: 64px; border-radius: 18px; background: var(--card); opacity: .6; }
