/* =========================================================================
   BRUTAL TODO — Neo-brutalism stylesheet
   Thick black borders, hard offset shadows, loud colors, heavy type.
   ========================================================================= */

:root {
  --ink: #111111;
  --bg: #faf3e0;
  --card: #ffffff;

  --yellow: #ffd23f;
  --pink: #ff5da2;
  --cyan: #38d6e6;
  --lime: #b6f500;
  --purple: #a685ff;
  --orange: #ff7a1a;
  --red: #ff4d4d;
  --green: #1ed16f;
  --blue: #4d8bff;

  --border: 3px solid var(--ink);
  --radius: 10px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --shadow-lg: 8px 8px 0 var(--ink);

  --font: "Space Grotesk", "Archivo", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: radial-gradient(var(--ink) 1.1px, transparent 1.1px);
  background-size: 26px 26px;
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 0.4em;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  text-transform: uppercase;
}

h2 {
  font-size: 1.35rem;
  text-transform: uppercase;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 26px 20px 80px;
}

.muted {
  color: #555;
  font-size: 0.9rem;
}

.center {
  text-align: center;
}

/* ----------------------------------------------------------------- NАВ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.25rem;
  text-transform: uppercase;
  text-decoration: none;
  background: var(--yellow);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 6px 12px;
}

.brand .spark {
  transform: rotate(-8deg);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  font-weight: 700;
  padding: 7px 12px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.nav-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.nav-link.is-active {
  background: var(--cyan);
}

.nav-badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  margin-left: 6px;
  font-size: 0.78rem;
  text-align: center;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: var(--border);
  object-fit: cover;
  background: var(--lime);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

/* -------------------------------------------------------------- BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  padding: 11px 18px;
  background: var(--card);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn--sm {
  padding: 7px 12px;
  font-size: 0.8rem;
  box-shadow: var(--shadow-sm);
}

.btn--block {
  width: 100%;
}

.btn--yellow { background: var(--yellow); }
.btn--pink { background: var(--pink); color: #fff; }
.btn--cyan { background: var(--cyan); }
.btn--lime { background: var(--lime); }
.btn--purple { background: var(--purple); color: #fff; }
.btn--green { background: var(--green); color: #fff; }
.btn--red { background: var(--red); color: #fff; }
.btn--orange { background: var(--orange); color: #fff; }
.btn--ghost { background: var(--card); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------------------------------------------------------------- CARDS */
.card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 22px;
}

.panel > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.count-pill {
  font-size: 0.8rem;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
}

/* -------------------------------------------------------------- BADGES */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #eee;
  white-space: nowrap;
}

.badge--todo { background: #e8e8e8; }
.badge--progress { background: var(--cyan); }
.badge--submitted { background: var(--orange); color: #fff; }
.badge--completed { background: var(--green); color: #fff; }

.badge--low { background: var(--lime); }
.badge--medium { background: var(--yellow); }
.badge--high { background: var(--red); color: #fff; }

.badge--cat {
  color: var(--ink);
}

.badge--overdue { background: var(--red); color: #fff; }
.badge--self { background: var(--purple); color: #fff; }

/* ------------------------------------------------------------ TASK CARD */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.task-card {
  display: block;
  text-decoration: none;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.task-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-lg);
}

.task-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.task-card__title {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.2;
}

.task-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.task-card__people {
  font-size: 0.82rem;
  color: #444;
  margin-top: 10px;
  border-top: 2px dashed #ddd;
  padding-top: 8px;
}

/* --------------------------------------------------------------- STATS */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.stat__num {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.stat__label {
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  margin-top: 6px;
}

.stat--yellow { background: var(--yellow); }
.stat--cyan { background: var(--cyan); }
.stat--pink { background: var(--pink); color: #fff; }
.stat--lime { background: var(--lime); }

/* --------------------------------------------------------------- FORMS */
.form label {
  display: block;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  margin: 14px 0 6px;
}

.form input,
.form textarea,
.form select,
.input {
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  padding: 11px 12px;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 0 transparent;
  outline: none;
}

.form input:focus,
.form textarea:focus,
.form select:focus,
.input:focus {
  box-shadow: var(--shadow-sm);
}

.form input[type="color"] {
  height: 48px;
  padding: 4px;
}

.form .helptext,
.form .errorlist {
  font-size: 0.8rem;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.form .errorlist {
  color: #b00020;
  font-weight: 700;
}

.field {
  margin-bottom: 6px;
}

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
}

.inline-form .input {
  flex: 1;
  min-width: 200px;
}

/* ------------------------------------------------------------- MESSAGES */
.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 10px;
}

.message {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  font-weight: 700;
  background: var(--card);
}

.message.success { background: var(--lime); }
.message.error { background: var(--red); color: #fff; }
.message.info { background: var(--cyan); }
.message.warning { background: var(--yellow); }

/* ----------------------------------------------------------- AUTH PAGES */
.auth-wrap {
  max-width: 440px;
  margin: 6vh auto;
  padding: 0 18px 60px;
}

.auth-card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.auth-logo {
  display: inline-block;
  background: var(--yellow);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 8px 14px;
  font-weight: 800;
  font-size: 1.3rem;
  text-transform: uppercase;
  margin-bottom: 18px;
  transform: rotate(-2deg);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: #666;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 3px;
  background: var(--ink);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  font-weight: 800;
  text-transform: uppercase;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.google-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-lg);
}

.google-g {
  width: 20px;
  height: 20px;
}

/* ------------------------------------------------------------- DETAIL */
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 22px;
  align-items: start;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 2px dashed #ddd;
}

.kv:last-child {
  border-bottom: none;
}

.kv span:first-child {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: #555;
}

.flow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 2px;
}

.flow .step {
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  background: #fff;
}

.flow .step.done { background: var(--green); color: #fff; }
.flow .step.current { background: var(--yellow); }
.flow .arrow { font-weight: 800; }

.comment {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  margin-bottom: 12px;
  background: #fff;
}

.comment__head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.note-box {
  background: var(--orange);
  color: #fff;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  margin: 14px 0;
  font-weight: 700;
}

/* ------------------------------------------------------------- PEOPLE */
.people-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: #fff;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.people-row .who {
  flex: 1;
}

.people-row .who b {
  display: block;
}

.empty {
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  font-weight: 700;
  color: #555;
  background: rgba(255, 255, 255, 0.6);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
}

.tag {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  vertical-align: middle;
}

@media (max-width: 760px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   v2 — animations, toasts, modals, attachments, three.js background
   ========================================================================= */

/* Three.js background canvas sits behind everything */
#bg3d {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
}

/* ---- keyframes ---- */
@keyframes popIn {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  60% { transform: translateY(-3px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(60px); }
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes wiggle {
  0%,100% { transform: rotate(0deg); }
  25% { transform: rotate(-2.5deg); }
  75% { transform: rotate(2.5deg); }
}

/* ---- card entrance animations ---- */
.task-card,
.stat,
.panel,
.people-row,
.comment {
  animation: popIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
/* stagger via JS-set custom property */
[style*="--i"] { animation-delay: calc(var(--i) * 60ms); }

.stat:hover { animation: wiggle 0.4s ease; }

@media (prefers-reduced-motion: reduce) {
  *, #bg3d { animation: none !important; }
  #bg3d { display: none; }
}

/* ---- toasts ---- */
.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, 92vw);
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 700;
  animation: slideInRight 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.toast.hiding { animation: slideOutRight 0.3s ease forwards; }
.toast--success { background: var(--lime); }
.toast--error { background: var(--red); color: #fff; }
.toast--info { background: var(--cyan); }
.toast--warning { background: var(--yellow); }
.toast span { flex: 1; }
.toast__x {
  cursor: pointer;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  font-weight: 800;
  width: 26px;
  height: 26px;
  line-height: 1;
  flex: none;
}

/* ---- modal popups ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 900;
  animation: overlayIn 0.2s ease both;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  animation: popIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.modal__head h2 { margin: 0; }

/* ---- attachments ---- */
.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.attach {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.attach:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow-lg); }
.attach__thumb {
  height: 110px;
  background: var(--bg);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.attach__thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach__icon { font-size: 2.4rem; }
.attach__body { padding: 8px 10px; }
.attach__name {
  font-weight: 700;
  font-size: 0.82rem;
  word-break: break-word;
  line-height: 1.2;
}
.attach__meta { font-size: 0.72rem; color: #555; margin-top: 4px; display:flex; justify-content:space-between; gap:6px; align-items:center; }

.dropzone {
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  font-weight: 700;
  background: rgba(255,255,255,0.7);
  transition: background 0.15s ease, transform 0.1s ease;
}
.dropzone.dragover { background: var(--yellow); transform: scale(1.01); }
.file-tabs { display:flex; gap:8px; margin-bottom:10px; flex-wrap:wrap; }

/* ========================== CHAT + TEARABLE CLOTH ========================= */
.chat-shell { display:grid; grid-template-columns:240px 1fr; gap:16px; }
.chat-side { border:var(--border); border-radius:var(--radius); box-shadow:var(--shadow); background:var(--card); padding:10px; max-height:74vh; overflow:auto; }
.chat-side h3 { margin:6px 8px 10px; text-transform:uppercase; font-size:.8rem; }
.chat-side a { display:flex; align-items:center; gap:10px; text-decoration:none; padding:8px; border:2px solid transparent; border-radius:8px; font-weight:700; margin-bottom:4px; }
.chat-side a.active, .chat-side a:hover { border-color:var(--ink); background:var(--bg); transform:translate(-1px,-1px); }
.chat-main { border:var(--border); border-radius:var(--radius); box-shadow:var(--shadow); background:var(--card); display:flex; flex-direction:column; min-height:74vh; max-height:74vh; }
.chat-head { border-bottom:var(--border); padding:12px 16px; display:flex; align-items:center; gap:10px; font-weight:800; }
.chat-log { flex:1; overflow:auto; padding:16px; display:flex; flex-direction:column; gap:10px; }
.bubble { max-width:78%; padding:9px 12px; border:var(--border); border-radius:12px; box-shadow:var(--shadow-sm); background:#fff; font-weight:600; animation:popIn .25s both; word-break:break-word; }
.bubble .who { font-size:.66rem; font-weight:800; text-transform:uppercase; opacity:.55; margin-bottom:2px; }
.bubble .time { font-size:.6rem; opacity:.5; margin-top:4px; text-align:right; }
.bubble.me { align-self:flex-end; background:var(--lime); }
.bubble.them { align-self:flex-start; background:var(--cyan); }
.bubble audio { width:230px; max-width:60vw; display:block; margin-top:2px; }
.chat-input { border-top:var(--border); padding:10px; display:flex; gap:8px; align-items:center; }
.chat-input .input { flex:1; }
.mic-btn.recording { background:var(--red); color:#fff; animation:wiggle .5s infinite; }
@media (max-width:760px){ .chat-shell{ grid-template-columns:1fr; } .chat-side{ max-height:none; } }

.cloth-intro { position:fixed; inset:0; z-index:850; background:var(--bg); overflow:hidden; }
.cloth-intro canvas { position:absolute; inset:0; width:100%; height:100%; cursor:grab; }
.cloth-intro canvas:active { cursor:grabbing; }
.cloth-ui { position:absolute; left:0; right:0; bottom:32px; z-index:2; text-align:center; pointer-events:none; }
.cloth-ui .btn { pointer-events:auto; }
.cloth-title { position:absolute; top:26px; left:50%; transform:translateX(-50%) rotate(-2deg); z-index:2; pointer-events:none; }
.cloth-title span { display:inline-block; font-size:clamp(1.6rem,5vw,3.2rem); font-weight:800; text-transform:uppercase; background:var(--yellow); border:var(--border); box-shadow:var(--shadow-lg); padding:6px 18px; }
.cloth-hint { display:block; margin-bottom:14px; font-weight:700; background:#fff; border:var(--border); box-shadow:var(--shadow-sm); padding:6px 12px; border-radius:999px; }

.brand-logo { vertical-align: middle; margin-right: 2px; }

.chat-img { max-width: 220px; max-height: 220px; border:var(--border); border-radius:8px; display:block; margin-top:2px; }
.chat-file { display:inline-block; font-weight:800; text-decoration:underline; margin-top:2px; word-break:break-all; }

.cloth-settings { position:absolute; top:24px; right:20px; z-index:3; }

.preset-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
.preset { padding:0; border:var(--border); border-radius:8px; box-shadow:var(--shadow-sm); background:#fff; cursor:pointer; overflow:hidden; aspect-ratio:1; }
.preset img { width:100
/* cloth design picker */
.preset-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.preset { padding: 0; border: var(--border); border-radius: 8px; box-shadow: var(--shadow-sm); background: #fff; cursor: pointer; overflow: hidden; aspect-ratio: 1; }
.preset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preset:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.preset--on { outline: 4px solid var(--green); }
@media (max-width: 520px) { .preset-grid { grid-template-columns: repeat(3, 1fr); } }
