/* ── fonts ──────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/geist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/geist-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/geist-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/geist-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:        #ffffff;
  --fg:        #000000;
  --col:       #f4f4f4;   /* column well */
  --card:      #ffffff;   /* card on top of it */
  --gray-100:  #f2f2f2;
  --gray-200:  #ebebeb;
  --gray-400:  #a1a1a1;
  --gray-600:  #666666;
  --line:      #e8e8e8;
  --red:       #d93036;
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --pad: 16px;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0a0a0a;
    --fg:       #ededed;
    --col:      #141414;
    --card:     #242424;
    --gray-100: #1a1a1a;
    --gray-200: #262626;
    --gray-400: #6b6b6b;
    --gray-600: #a1a1a1;
    --line:     #262626;
    --red:      #ff6369;
    color-scheme: dark;
  }
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
body { height: 100dvh; overflow: hidden; }

button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { background: none; border: 0; outline: none; }
[hidden] { display: none !important; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ── buttons ────────────────────────────────────────────────────────────── */
.btn {
  height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
  transition: opacity .15s ease, background .15s ease;
}
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:active { opacity: .8; }
.btn-danger { background: var(--gray-100); color: var(--red); }

/* ── lock ───────────────────────────────────────────────────────────────── */
.lock { height: 100dvh; display: grid; place-items: center; padding: var(--pad); }
.lock-form { display: grid; gap: 16px; width: 100%; max-width: 260px; text-align: center; }
.pin {
  width: 100%;
  font-family: var(--mono);
  font-size: 34px;
  letter-spacing: 0.34em;
  text-align: center;
  text-indent: 0.34em;   /* balance the trailing letter-space */
  padding: 18px 0;
  background: var(--gray-100);
  border-radius: 8px;
}
.lock-error { margin: 0; font-size: 14px; color: var(--red); }

/* ── shell ──────────────────────────────────────────────────────────────── */
.app {
  height: 100dvh;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

.top { flex: none; padding: 10px 0 8px; }

.filters {
  display: flex; gap: 6px;
  padding: 0 var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

/* ── pills ──────────────────────────────────────────────────────────────── */
.pill {
  flex: none;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.pill.is-active { background: var(--fg); color: var(--bg); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.pill .n { font-family: var(--mono); font-size: 11px; color: var(--gray-400); }
.pill.is-active .n { color: var(--bg); opacity: .6; }
.pills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── board ──────────────────────────────────────────────────────────────── */
.board {
  flex: 1; min-height: 0;
  display: flex; gap: 10px;
  padding: 4px var(--pad) calc(env(safe-area-inset-bottom) + 10px);
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.board::-webkit-scrollbar { display: none; }

.col {
  flex: 0 0 min(300px, calc(100vw - 52px));
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--col);
  border-radius: var(--r);
  scroll-snap-align: start;
}

.col-head {
  flex: none;
  display: flex; align-items: center; gap: 7px;
  padding: 12px 12px 8px;
  font-size: 13px; font-weight: 500;
}
.col-head .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.col-head .n {
  font-family: var(--mono); font-size: 11.5px; color: var(--gray-400);
  margin-right: auto;
}
.col-act {
  font-size: 12px; color: var(--gray-400);
  padding: 2px 6px; border-radius: 6px;
}
.col-act:active { color: var(--fg); }
.col-add { font-size: 19px; line-height: 1; color: var(--gray-400); padding: 0 4px 3px; }

.col-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 0 8px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.col-body::-webkit-scrollbar { display: none; }

/* ── card ───────────────────────────────────────────────────────────────── */
.card {
  flex: none;
  background: var(--card);
  border-radius: 10px;
  padding: 10px 11px;
  cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: opacity .15s ease;
}
.card-title { font-size: 14px; line-height: 1.35; letter-spacing: -0.01em; word-break: break-word; }
.card-note {
  margin-top: 4px;
  font-size: 12.5px; line-height: 1.35; color: var(--gray-600);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tag {
  margin-top: 7px;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; color: var(--gray-600);
}
.card-tag .dot { width: 6px; height: 6px; border-radius: 50%; }

/* The card being dragged is lifted out of the flow and follows the finger; the
   placeholder holds the gap it will land in. */
.card.dragging {
  position: fixed; z-index: 60; top: 0; left: 0;
  pointer-events: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .22);
  cursor: grabbing;
}
.ph {
  flex: none;
  border-radius: 10px;
  background: var(--gray-200);
  opacity: .7;
}
body.is-dragging { cursor: grabbing; }
body.is-dragging .card:not(.dragging) { transition: transform .12s ease; }


/* ── composer ───────────────────────────────────────────────────────────── */
.composer {
  flex: none;
  background: var(--card);
  border-radius: 10px;
  padding: 10px 11px;
}
.composer textarea {
  width: 100%;
  font-size: 14px; line-height: 1.35; letter-spacing: -0.01em;
  resize: none;
}

/* ── sheet ──────────────────────────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; }
.sheet-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .38); }
.sheet-panel {
  position: relative;
  width: 100%; max-width: 480px; margin: 0 auto;
  max-height: 92dvh; overflow-y: auto;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  padding: 8px var(--pad) calc(env(safe-area-inset-bottom) + 16px);
  display: flex; flex-direction: column; gap: 12px;
  animation: rise .22s cubic-bezier(.32, .72, 0, 1);
}
@keyframes rise { from { transform: translateY(16px); opacity: .6; } }
.sheet-grip {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--gray-200);
  margin: 4px auto 2px;
}

.s-title {
  width: 100%; resize: none;
  font-size: 20px; font-weight: 500; line-height: 1.3; letter-spacing: -0.02em;
}
.s-note {
  width: 100%; resize: none;
  min-height: 60px;
  font-size: 15px; line-height: 1.45; color: var(--gray-600);
}
.s-title::placeholder, .s-note::placeholder { color: var(--gray-400); }
.s-new-project {
  height: 38px; padding: 0 12px;
  background: var(--gray-100); border-radius: 8px;
  font-size: 14px;
}

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 3px; padding: 3px;
  background: var(--gray-100); border-radius: 9px;
}
.seg button {
  padding: 8px 0; border-radius: 6px;
  font-size: 13.5px; font-weight: 500; color: var(--gray-600);
  transition: background .15s ease, color .15s ease;
}
.seg button.is-active { background: var(--bg); color: var(--fg); }

.sheet-actions { display: flex; gap: 8px; margin-top: 2px; }
.sheet-actions .btn { flex: 1; }

/* ── toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; z-index: 90;
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  max-width: calc(100% - 32px);
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--fg); color: var(--bg);
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.is-error { background: var(--red); color: #fff; }

/* ── desktop ────────────────────────────────────────────────────────────── */
@media (min-width: 760px) {
  .board {
    scroll-snap-type: none;
    justify-content: center;
    padding-bottom: 16px;
  }
  .col { flex: 0 0 320px; }
  .top { padding-top: 14px; }
  .filters { justify-content: center; }
  .card:hover { background: color-mix(in srgb, var(--card) 92%, var(--fg)); }
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 16px; max-height: 86dvh; }
}
