:root {
  --bg: #eef1f4;
  --ink: #15202b;
  --muted: #5b6b7a;
  --card: #ffffff;
  --line: #d7dee6;
  --accent: #1f6feb;
  --accent-ink: #fff;
  --created: #6b7280;
  --progress: #c47b17;
  --done: #1a7f4a;
  --danger: #c0352b;
  --shadow: 0 8px 24px rgba(21, 32, 43, 0.08);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 400px at 10% -10%, #dce8f7 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 8px;
  max-width: 1400px;
  margin: 0 auto;
}
.brand { display: flex; gap: 12px; align-items: center; }
.mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--ink);
  box-shadow: inset 0 -10px 0 0 #f4d35e;
  flex: 0 0 auto;
}
.top h1 { margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }
.top p { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { border-color: #b7c2ce; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f0c4c0; }
.btn.danger.ghost:hover { background: #fdecea; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.small { padding: 6px 10px; font-size: 0.82rem; font-weight: 600; }

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 16px 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}
.column {
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  padding: 12px;
}
.column.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: #e8f0fe; }
.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 12px;
  position: sticky;
  top: 0;
}
.col-head h2 {
  margin: 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.created { background: var(--created); }
.dot.in_progress { background: var(--progress); }
.dot.done { background: var(--done); }
.count {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  padding: 2px 8px;
}
.cards { display: flex; flex-direction: column; gap: 10px; min-height: 80px; flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.45; }
.card h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.3; }
.card .desc {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.meta { display: flex; gap: 10px; color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.modal {
  border: none;
  border-radius: 18px;
  padding: 0;
  width: min(520px, calc(100vw - 24px));
  box-shadow: 0 24px 80px rgba(21,32,43,0.28);
}
.modal.wide { width: min(680px, calc(100vw - 16px)); }
.modal::backdrop { background: rgba(21,32,43,0.45); }
.modal form, .sheet { padding: 22px; }
.modal h2, .block h3 { margin: 0 0 12px; font-size: 1.1rem; }
label { display: block; font-weight: 600; font-size: 0.88rem; margin: 0 0 12px; }
input[type=text], textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
}
textarea { resize: vertical; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.actions.wrap { flex-wrap: wrap; }
.sheet { max-height: calc(100vh - 48px); overflow: auto; }
.block { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

.notes, .files { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notes li, .files li {
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.notes .when, .files .when { color: var(--muted); font-size: 0.75rem; font-weight: 600; margin-bottom: 4px; }
.notes .text { white-space: pre-wrap; margin: 0; font-size: 0.92rem; }
.note-form textarea { margin-bottom: 8px; }
.files li { display: flex; gap: 10px; align-items: center; }
.files .preview {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #e5e9ee; flex: 0 0 auto;
}
.files .info { flex: 1; min-width: 0; }
.files .info a { color: var(--accent); font-weight: 650; text-decoration: none; word-break: break-all; }
.files .info a:hover { text-decoration: underline; }
.hint { color: var(--muted); font-size: 0.8rem; }
.file-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.move-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 40;
  box-shadow: var(--shadow);
}

.empty {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 24px 8px;
}

@media (max-width: 900px) {
  .board {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px 32px;
    gap: 12px;
  }
  .column {
    flex: 0 0 min(86vw, 360px);
    scroll-snap-align: start;
    min-height: 60vh;
  }
  .top { padding: 16px 16px 4px; }
  .top p { display: none; }
}
