:root {
  --bg: #f6f3ee; --card: #fff; --ink: #24211d; --muted: #8a837a; --line: #e6e0d6;
  --accent: #d9603b; --stas: #3b7dd9; --liza: #c2489a; --ok: #3a9a5b; --late: #d23c3c;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); border-radius: 10px; padding: 8px 14px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--late); }
button.link { border: none; background: none; color: var(--muted); padding: 4px 8px; }
.hidden { display: none !important; }
.err { color: var(--late); min-height: 1.4em; }

/* login */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: var(--card); border-radius: 18px; padding: 28px; width: 100%; max-width: 340px;
  text-align: center; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.who { display: flex; gap: 10px; justify-content: center; }
.who button { flex: 1; padding: 14px; font-size: 18px; }
#code { width: 100%; font-size: 28px; letter-spacing: 8px; text-align: center; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
#verify { width: 100%; padding: 12px; }

/* header */
header { display: flex; align-items: center; gap: 12px; padding: 14px 16px 8px; flex-wrap: wrap;
  padding-top: max(14px, env(safe-area-inset-top)); }
header h1 { font-size: 20px; margin: 0; flex: 1; }
.filters { display: flex; gap: 4px; background: #ebe6dd; border-radius: 12px; padding: 3px; }
.filters button { border: none; background: none; padding: 6px 12px; border-radius: 9px; font-size: 14px; }
.filters button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.small { font-size: 14px; }

/* board */
.tabs { display: none; }
#board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 8px 16px 100px; }
.col h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 4px; }
.cards { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.empty { color: var(--muted); font-size: 14px; padding: 12px 4px; }

.card { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border-left: 4px solid var(--line); cursor: pointer; }
.card.to-stas { border-left-color: var(--stas); }
.card.to-liza { border-left-color: var(--liza); }
.card .t { font-weight: 600; word-break: break-word; }
.card.done .t { text-decoration: line-through; color: var(--muted); }
.card .n { color: var(--muted); font-size: 14px; margin-top: 4px; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .m { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pill { border-radius: 999px; padding: 1px 8px; font-size: 12px; color: #fff; }
.pill.stas { background: var(--stas); } .pill.liza { background: var(--liza); }
.due.late { color: var(--late); font-weight: 600; }
.card .move { margin-left: auto; display: flex; gap: 6px; }
.card .move button { padding: 3px 10px; font-size: 13px; }
.card .move .go { background: var(--ok); border-color: var(--ok); color: #fff; }

.fab { position: fixed; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); width: 60px; height: 60px;
  border-radius: 50%; border: none; background: var(--accent); color: #fff; font-size: 32px; line-height: 1;
  box-shadow: 0 6px 20px rgba(217,96,59,.4); }

/* editor */
dialog { border: none; border-radius: 18px; padding: 0; width: min(480px, calc(100vw - 24px));
  box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(30,25,20,.35); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
dialog h2 { margin: 0; font-size: 20px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; }
input, textarea, select { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; background: #fff; width: 100%; }
textarea { resize: vertical; }
.row { display: flex; gap: 10px; }
.actions { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }
.meta { font-size: 12px; color: var(--muted); margin: 0; }
.files { border-top: 1px solid var(--line); padding-top: 10px; }
.files-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
label.attach-btn { flex: none; flex-direction: row; color: var(--ink); font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; background: #fff; }
#file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.file { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 10px; padding: 6px 8px; }
.file .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: #e9e3d9;
  display: grid; place-items: center; font-size: 20px; }
.file a { color: var(--ink); text-decoration: none; flex: 1; min-width: 0; font-size: 14px; }
.file a .nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file a .sz { font-size: 12px; color: var(--muted); }
.file button { border: none; background: none; color: var(--muted); padding: 4px 8px; font-size: 16px; }
.file.pending { opacity: .6; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; min-height: 0; }
.card .clip { white-space: nowrap; }

/* drag & drop */
.card { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.card.dragging { opacity: .35; }
.ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; margin: 0;
  box-shadow: 0 12px 32px rgba(0,0,0,.22); opacity: .95; transform-origin: 0 0; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }
.col { border-radius: 16px; transition: background .12s, box-shadow .12s; }
.col.drop-on { background: rgba(217,96,59,.08); box-shadow: inset 0 0 0 2px rgba(217,96,59,.45); }
.tabs button.drop-on { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important;
  transform: scale(1.05); }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60;
  transition: opacity .2s, transform .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
  header { gap: 8px; }
  header h1 { font-size: 18px; white-space: nowrap; flex-basis: 100%; }
  .filters { flex: 1; }
  .filters button { flex: 1; }
  header #logout { margin-left: auto; }
  .tabs { display: flex; gap: 6px; padding: 4px 16px 8px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
  .tabs button { flex: 1; border-radius: 10px; font-size: 14px; padding: 8px 4px; }
  .tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
  .tabs span { opacity: .7; }
  #board { grid-template-columns: 1fr; }
  .col { display: none; } .col.on { display: block; }
  .col h2 { display: none; }
}
