/* ============================================================
   Unsolve Tasks — Trello-inspired UI
   ============================================================ */
:root {
  --bg:#1d2125; --bg-2:#22272b; --bg-3:#282e33; --bg-4:#2c333a;
  --surface:#22272b; --surface-2:#282e33; --border:#3a434b; --border-2:#454f59;
  --text:#b6c2cf; --text-strong:#dee4ea; --text-dim:#8c9bab; --text-faint:#738496;
  --accent:#4f46e5; --accent-2:#6366f1; --accent-soft:#5b6fff;
  --link:#85b8ff;
  --green:#4bce97; --green-d:#216e4e;
  --red:#f87168; --red-d:#ae2e24;
  --yellow:#f5cd47; --yellow-d:#7f5f01;
  --orange:#fea362;
  --blue:#579dff;
  --radius:8px; --radius-sm:6px;
  --shadow:0 1px 1px rgba(0,0,0,.25),0 0 1px rgba(0,0,0,.5);
  --shadow-lg:0 8px 30px rgba(0,0,0,.5);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --header-h:48px; --sidebar-w:260px;
}

* { box-sizing:border-box; }
html,body { height:100%; }
body {
  margin:0; font-family:var(--font); font-size:14px; color:var(--text);
  background:var(--bg); -webkit-font-smoothing:antialiased; overflow:hidden;
}
button { font-family:inherit; cursor:pointer; }
a { color:var(--link); text-decoration:none; }
a:hover { text-decoration:underline; }
::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,.18); border-radius:6px; border:2px solid transparent; background-clip:padding-box; }
::-webkit-scrollbar-thumb:hover { background:rgba(255,255,255,.3); background-clip:padding-box; }

/* ---------- Boot spinner ---------- */
.app-loading { display:grid; place-items:center; height:100vh; }
.boot-spinner span {
  width:36px; height:36px; border:3px solid var(--border); border-top-color:var(--accent);
  border-radius:50%; display:block; animation:spin .7s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ---------- Buttons ---------- */
.btn {
  display:inline-flex; align-items:center; gap:6px; border:none; border-radius:var(--radius-sm);
  padding:8px 14px; font-size:14px; font-weight:600; background:var(--bg-4); color:var(--text-strong);
  transition:background .12s, opacity .12s; line-height:1;
}
.btn:hover { background:#39424a; }
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:var(--accent-2); }
.btn-danger { background:var(--red-d); color:#fff; }
.btn-danger:hover { background:#bb3024; }
.btn-ghost { background:transparent; color:var(--text); }
.btn-ghost:hover { background:rgba(255,255,255,.08); }
.btn-sm { padding:5px 10px; font-size:13px; }
.btn-block { width:100%; justify-content:center; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.icon-btn {
  background:transparent; border:none; color:var(--text); width:32px; height:32px; border-radius:var(--radius-sm);
  display:inline-grid; place-items:center; transition:background .12s;
}
.icon-btn:hover { background:rgba(255,255,255,.12); }

/* ---------- Inputs ---------- */
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=date], input[type=datetime-local], select, textarea {
  width:100%; background:var(--bg); border:2px solid var(--border-2); border-radius:var(--radius-sm);
  color:var(--text-strong); padding:9px 11px; font-size:14px; font-family:inherit; outline:none;
  transition:border-color .12s, background .12s;
}
input:focus, select:focus, textarea:focus { border-color:var(--accent-soft); background:#1a1d21; }
textarea { resize:vertical; min-height:80px; line-height:1.5; }
label.field { display:block; margin-bottom:14px; }
label.field > span { display:block; font-size:12px; font-weight:700; color:var(--text-dim); text-transform:uppercase; letter-spacing:.04em; margin-bottom:6px; }

/* ---------- Layout ---------- */
.shell { display:flex; flex-direction:column; height:100vh; }
.topbar {
  height:var(--header-h); flex:0 0 var(--header-h); display:flex; align-items:center; gap:14px;
  padding:0 14px; background:#1a1d21cc; backdrop-filter:blur(6px); border-bottom:1px solid #00000040; z-index:30;
}
.topbar .logo { display:flex; align-items:center; gap:9px; font-weight:800; color:var(--text-strong); font-size:15px; }
.topbar .logo .mark { width:26px; height:26px; border-radius:7px; background:linear-gradient(135deg,#6366f1,#4f46e5); display:grid; place-items:center; color:#fff; font-weight:900; }
.topbar .spacer { flex:1; }
.searchbox { position:relative; width:min(420px,40vw); }
.searchbox input { padding-left:34px; height:36px; }
.searchbox .si { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--text-faint); }
.search-results {
  position:absolute; top:42px; left:0; right:0; background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow-lg); max-height:60vh; overflow:auto; z-index:50; padding:6px;
}
.search-results .sr { padding:9px 10px; border-radius:6px; cursor:pointer; display:flex; flex-direction:column; gap:3px; }
.search-results .sr:hover { background:var(--bg-4); }
.search-results .sr .meta { font-size:12px; color:var(--text-faint); }
.search-empty { padding:14px; color:var(--text-faint); text-align:center; }

.body { flex:1; display:flex; min-height:0; }

/* ---------- Sidebar ---------- */
.sidebar {
  width:var(--sidebar-w); flex:0 0 var(--sidebar-w); background:#1a1d21; border-right:1px solid #00000040;
  display:flex; flex-direction:column; overflow:hidden; transition:margin-left .2s;
}
.sidebar.collapsed { margin-left:calc(var(--sidebar-w) * -1); }
.sidebar .scroll { overflow-y:auto; padding:10px 8px 20px; flex:1; }
.nav-section { margin-bottom:6px; }
.nav-section .title { font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:var(--text-faint); padding:12px 12px 6px; display:flex; align-items:center; justify-content:space-between; }
.nav-item {
  display:flex; align-items:center; gap:11px; padding:8px 12px; border-radius:var(--radius-sm); color:var(--text);
  cursor:pointer; font-weight:500; position:relative; user-select:none;
}
.nav-item:hover { background:rgba(255,255,255,.07); text-decoration:none; }
.nav-item.active { background:var(--accent); color:#fff; }
.nav-item.active .badge { background:rgba(255,255,255,.25); color:#fff; }
.nav-item .ic { width:18px; text-align:center; flex:0 0 18px; }
.nav-item .lbl { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.nav-item .badge { background:var(--bg-4); color:var(--text-dim); border-radius:10px; font-size:11px; font-weight:700; padding:1px 7px; min-width:20px; text-align:center; }
.nav-item .badge.warn { background:var(--red-d); color:#fff; }
.board-dot { width:18px; height:18px; border-radius:4px; flex:0 0 18px; }

/* ---------- Main content ---------- */
.main { flex:1; min-width:0; display:flex; flex-direction:column; position:relative; }

/* Board backgrounds */
.bg-gradient-blue   { background:linear-gradient(135deg,#0079bf,#5067c5); }
.bg-gradient-purple { background:linear-gradient(135deg,#5b3a9e,#8e44ad); }
.bg-gradient-green  { background:linear-gradient(135deg,#0b6e4f,#15a37f); }
.bg-gradient-orange { background:linear-gradient(135deg,#d2691e,#e8843a); }
.bg-gradient-pink   { background:linear-gradient(135deg,#b5306e,#e8588f); }
.bg-gradient-teal   { background:linear-gradient(135deg,#0f7b8a,#1aa0b3); }
.bg-gradient-slate  { background:linear-gradient(135deg,#2c3e50,#4a6075); }
.bg-gradient-sunset { background:linear-gradient(135deg,#ff5f6d,#ffc371); }
.bg-midnight        { background:#1d2125; }

/* ---------- Board header ---------- */
.board-head {
  display:flex; align-items:center; gap:12px; padding:12px 18px; min-height:56px;
  background:rgba(0,0,0,.16); backdrop-filter:blur(4px); color:#fff;
}
.board-head h1 { font-size:18px; font-weight:800; margin:0; cursor:pointer; padding:4px 8px; border-radius:6px; }
.board-head h1:hover { background:rgba(255,255,255,.16); }
.board-head .spacer { flex:1; }
.board-head .members { display:flex; }
.board-head .members .avatar { margin-left:-6px; border:2px solid rgba(0,0,0,.2); }
.board-head .hbtn { background:rgba(255,255,255,.2); color:#fff; border:none; border-radius:6px; padding:7px 12px; font-weight:600; font-size:13px; display:inline-flex; gap:6px; align-items:center; }
.board-head .hbtn:hover { background:rgba(255,255,255,.32); }

/* ---------- Board canvas / lists ---------- */
.board-scroll { flex:1; overflow-x:auto; overflow-y:hidden; padding:6px 12px 16px; }
.lists { display:flex; align-items:flex-start; gap:12px; height:100%; }
.list {
  width:286px; flex:0 0 286px; background:var(--bg-2); border-radius:12px; max-height:100%;
  display:flex; flex-direction:column; box-shadow:var(--shadow);
}
.list-head { display:flex; align-items:center; gap:6px; padding:10px 8px 6px 14px; }
.list-head .name { flex:1; font-weight:700; color:var(--text-strong); font-size:14px; padding:3px 4px; border-radius:5px; cursor:pointer; }
.list-head .name:hover { background:rgba(255,255,255,.06); }
.list-head input.name-edit { font-weight:700; padding:4px 6px; }
.list-head .count { color:var(--text-faint); font-size:12px; font-weight:600; padding:0 4px; }
.list-cards { overflow-y:auto; padding:2px 8px; flex:1; min-height:8px; display:flex; flex-direction:column; gap:8px; }
.list-foot { padding:6px 8px 10px; }
.add-card-btn { width:100%; text-align:left; background:transparent; border:none; color:var(--text-dim); padding:8px 10px; border-radius:8px; font-weight:600; }
.add-card-btn:hover { background:rgba(255,255,255,.07); color:var(--text-strong); }

.add-list { width:286px; flex:0 0 286px; }
.add-list .opener { width:100%; text-align:left; background:rgba(255,255,255,.16); color:#fff; border:none; padding:11px 14px; border-radius:12px; font-weight:600; backdrop-filter:blur(4px); }
.add-list .opener:hover { background:rgba(255,255,255,.26); }
.add-list .form { background:var(--bg-2); border-radius:12px; padding:8px; }
.add-list .form .row { display:flex; gap:8px; margin-top:8px; }

/* ---------- Card ---------- */
.card {
  background:var(--surface-2); border-radius:8px; padding:8px 10px 9px; box-shadow:var(--shadow);
  cursor:pointer; border:1px solid transparent; position:relative;
}
.card:hover { border-color:var(--border-2); }
.card.completed { opacity:.6; }
.card.completed .card-title { text-decoration:line-through; }
.card .labels { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:6px; }
.card .label-chip { height:8px; min-width:36px; border-radius:4px; }
.card-title { color:var(--text-strong); line-height:1.35; word-break:break-word; display:flex; gap:7px; align-items:flex-start; }
.card-title .check {
  flex:0 0 16px; width:16px; height:16px; border:2px solid var(--text-faint); border-radius:50%; margin-top:1px;
  display:grid; place-items:center; font-size:10px; color:transparent;
}
.card-title .check:hover { border-color:var(--green); }
.card.completed .card-title .check { background:var(--green); border-color:var(--green); color:#1d2125; }
.card-badges { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:7px; color:var(--text-faint); font-size:12px; }
.card-badges .b { display:inline-flex; align-items:center; gap:4px; }
.card-badges .due { padding:2px 6px; border-radius:5px; font-weight:600; }
.card-badges .due.overdue { background:var(--red-d); color:#fff; }
.card-badges .due.today { background:var(--yellow-d); color:#fff; }
.card-badges .due.done { background:var(--green-d); color:#fff; }
.card-badges .prio { font-weight:700; }
.prio-1 { color:var(--red); } .prio-2 { color:var(--orange); } .prio-3 { color:var(--blue); } .prio-4 { color:var(--text-faint); }
.card-badges .avatars { margin-left:auto; display:flex; }
.card-badges .avatars .avatar { margin-left:-5px; }

.avatar { width:24px; height:24px; border-radius:50%; display:inline-grid; place-items:center; color:#fff; font-size:11px; font-weight:700; flex:0 0 auto; text-transform:uppercase; }
.avatar.sm { width:20px; height:20px; font-size:10px; }
.avatar.lg { width:36px; height:36px; font-size:14px; }

/* Sortable helpers */
.card-ghost { opacity:.45; }
.card-chosen { cursor:grabbing; }
.card-drag { transform:rotate(3deg); }
.list-ghost { opacity:.5; }

/* ---------- Empty / boards grid ---------- */
.boards-view { flex:1; overflow:auto; padding:28px 32px; }
.boards-view h2 { color:var(--text-strong); margin:0 0 18px; }
.boards-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:16px; }
.board-tile { height:104px; border-radius:10px; padding:14px; color:#fff; font-weight:800; position:relative; cursor:pointer; box-shadow:var(--shadow); overflow:hidden; display:flex; flex-direction:column; justify-content:space-between; }
.board-tile:hover { filter:brightness(1.08); text-decoration:none; }
.board-tile .tcount { font-size:12px; font-weight:600; opacity:.9; }
.board-tile.new { background:var(--bg-3); color:var(--text-dim); border:1px dashed var(--border-2); align-items:center; justify-content:center; font-weight:600; }
.board-tile.new:hover { background:var(--bg-4); color:var(--text-strong); }

/* ---------- Smart view (list of tasks) ---------- */
.tasks-view { flex:1; overflow:auto; padding:24px 28px; }
.tasks-view .vh { display:flex; align-items:center; gap:10px; margin-bottom:18px; color:var(--text-strong); }
.tasks-view .vh h2 { margin:0; font-size:22px; }
.task-row {
  display:flex; align-items:flex-start; gap:11px; background:var(--surface); border:1px solid var(--border);
  border-radius:9px; padding:11px 14px; margin-bottom:8px; cursor:pointer; max-width:820px;
}
.task-row:hover { border-color:var(--border-2); background:var(--surface-2); }
.task-row .check { flex:0 0 18px; width:18px; height:18px; border:2px solid var(--text-faint); border-radius:50%; margin-top:1px; display:grid; place-items:center; color:transparent; }
.task-row .check:hover { border-color:var(--green); }
.task-row.completed .check { background:var(--green); border-color:var(--green); color:#1d2125; }
.task-row.completed .t-title { text-decoration:line-through; color:var(--text-faint); }
.task-row .t-main { flex:1; min-width:0; }
.task-row .t-title { color:var(--text-strong); font-weight:500; }
.task-row .t-meta { display:flex; flex-wrap:wrap; gap:10px; margin-top:5px; font-size:12px; color:var(--text-faint); align-items:center; }
.task-row .t-board { display:inline-flex; align-items:center; gap:6px; }
.task-row .t-board .dot { width:10px; height:10px; border-radius:3px; }
.empty-state { color:var(--text-faint); text-align:center; padding:60px 20px; }
.empty-state .big { font-size:46px; margin-bottom:10px; }

/* ---------- Modal ---------- */
.overlay { position:fixed; inset:0; background:rgba(0,0,0,.62); z-index:100; display:flex; justify-content:center; align-items:flex-start; overflow-y:auto; padding:40px 16px; }
.modal { background:var(--surface); border-radius:12px; width:100%; max-width:780px; box-shadow:var(--shadow-lg); border:1px solid var(--border); }
.modal.sm { max-width:440px; }
.modal-head { display:flex; align-items:flex-start; gap:10px; padding:18px 18px 6px; }
.modal-head .mtitle { flex:1; }
.modal-head .mtitle textarea { font-size:19px; font-weight:700; min-height:0; border-color:transparent; background:transparent; padding:5px 7px; resize:none; overflow:hidden; line-height:1.3; }
.modal-head .mtitle textarea:focus { background:#1a1d21; border-color:var(--accent-soft); }
.modal-head .mtitle .crumb { color:var(--text-faint); font-size:12px; padding:0 7px; margin-top:2px; }
.modal-body { padding:6px 18px 22px; display:grid; grid-template-columns:1fr 180px; gap:22px; }
.modal-sm-body { padding:6px 20px 22px; }
.modal-main { min-width:0; }
.modal-side { display:flex; flex-direction:column; gap:8px; }
.modal-side .sgroup-label { font-size:11px; font-weight:800; color:var(--text-faint); text-transform:uppercase; letter-spacing:.05em; margin:8px 0 2px; }
.side-btn { display:flex; align-items:center; gap:8px; background:var(--bg-4); border:none; color:var(--text-strong); padding:8px 10px; border-radius:6px; font-weight:600; font-size:13px; text-align:left; width:100%; }
.side-btn:hover { background:#39424a; }
.side-btn.danger:hover { background:var(--red-d); color:#fff; }

.section { margin-bottom:22px; }
.section > .sh { display:flex; align-items:center; gap:9px; color:var(--text-strong); font-weight:700; margin-bottom:9px; }
.section > .sh .ic { color:var(--text-dim); }
.section > .sh .spacer { flex:1; }

.chips { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.chip { display:inline-flex; align-items:center; gap:6px; border-radius:6px; padding:4px 9px; font-size:12px; font-weight:700; color:#fff; }
.chip.removable { cursor:pointer; }

.desc-box { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:11px 13px; min-height:46px; color:var(--text); white-space:pre-wrap; cursor:pointer; line-height:1.55; }
.desc-box.empty { color:var(--text-faint); }
.desc-box:hover { background:#1a1d21; }
.desc-rendered a { color:var(--link); }
.desc-rendered code { background:#00000050; padding:1px 5px; border-radius:4px; font-size:13px; }

/* checklist */
.checklist { margin-bottom:14px; }
.checklist .ch-head { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.checklist .ch-head .ct { font-weight:700; color:var(--text-strong); flex:1; }
.progress { height:8px; background:var(--bg-4); border-radius:5px; overflow:hidden; margin:4px 0 10px; }
.progress > span { display:block; height:100%; background:var(--green); transition:width .2s; }
.ci { display:flex; align-items:center; gap:9px; padding:4px 4px; border-radius:6px; }
.ci:hover { background:rgba(255,255,255,.05); }
.ci .box { width:16px; height:16px; border:2px solid var(--text-faint); border-radius:4px; flex:0 0 16px; display:grid; place-items:center; color:transparent; cursor:pointer; }
.ci.done .box { background:var(--green); border-color:var(--green); color:#1d2125; }
.ci.done .citext { text-decoration:line-through; color:var(--text-faint); }
.ci .citext { flex:1; cursor:text; }
.ci .del { opacity:0; }
.ci:hover .del { opacity:1; }

/* comments + activity */
.comment, .act { display:flex; gap:10px; margin-bottom:14px; }
.comment .cbody { flex:1; }
.comment .cmeta { font-size:12px; color:var(--text-faint); margin-bottom:3px; }
.comment .cmeta strong { color:var(--text-strong); }
.comment .ctext { background:var(--surface-2); border:1px solid var(--border); border-radius:8px; padding:9px 12px; white-space:pre-wrap; line-height:1.5; }
.comment .cactions { font-size:12px; margin-top:3px; display:flex; gap:10px; }
.comment .cactions a { color:var(--text-faint); cursor:pointer; }
.act { font-size:13px; color:var(--text-dim); align-items:center; gap:8px; margin-bottom:9px; }
.act .at { flex:1; }
.act . atime { font-size:11px; color:var(--text-faint); }

/* attachments */
.att { display:flex; align-items:center; gap:11px; padding:8px; border-radius:8px; }
.att:hover { background:rgba(255,255,255,.05); }
.att .thumb { width:60px; height:46px; border-radius:6px; background:var(--bg-4); display:grid; place-items:center; overflow:hidden; flex:0 0 60px; }
.att .thumb img { width:100%; height:100%; object-fit:cover; }
.att .ameta { flex:1; min-width:0; }
.att .aname { color:var(--text-strong); font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.att .asub { font-size:12px; color:var(--text-faint); }

/* ---------- Popover ---------- */
.popover { position:fixed; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow-lg); width:300px; z-index:140; padding:10px 12px 14px; }
.popover .ph { text-align:center; font-weight:700; color:var(--text-strong); font-size:13px; padding-bottom:8px; margin-bottom:8px; border-bottom:1px solid var(--border); position:relative; }
.popover .ph .x { position:absolute; right:0; top:-2px; }
.pop-item { display:flex; align-items:center; gap:9px; padding:7px 8px; border-radius:6px; cursor:pointer; }
.pop-item:hover { background:rgba(255,255,255,.08); }
.pop-label { flex:1; height:30px; border-radius:5px; display:flex; align-items:center; padding:0 10px; color:#fff; font-weight:600; font-size:13px; }
.swatches { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; margin:8px 0; }
.swatch { height:30px; border-radius:5px; cursor:pointer; border:2px solid transparent; }
.swatch.sel { border-color:#fff; }

/* ---------- Auth ---------- */
.auth-wrap { min-height:100vh; display:grid; place-items:center; padding:20px; background:radial-gradient(1200px 600px at 50% -10%, #2a2f5e, #15171c 60%); }
.auth-card { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:30px 30px 26px; width:100%; max-width:400px; box-shadow:var(--shadow-lg); }
.auth-card .brand { display:flex; align-items:center; gap:11px; justify-content:center; margin-bottom:6px; }
.auth-card .brand .mark { width:38px; height:38px; border-radius:9px; background:linear-gradient(135deg,#6366f1,#4f46e5); display:grid; place-items:center; color:#fff; font-weight:900; font-size:18px; }
.auth-card h1 { text-align:center; font-size:21px; color:var(--text-strong); margin:4px 0 2px; }
.auth-card .sub { text-align:center; color:var(--text-faint); margin-bottom:22px; font-size:13px; }
.auth-card .switch { text-align:center; margin-top:16px; color:var(--text-faint); font-size:13px; }
.auth-card .err { background:var(--red-d); color:#fff; border-radius:7px; padding:9px 12px; margin-bottom:14px; font-size:13px; }

/* ---------- Toasts ---------- */
.toasts { position:fixed; bottom:18px; right:18px; z-index:200; display:flex; flex-direction:column; gap:9px; }
.toast { background:var(--surface-2); border:1px solid var(--border); border-left:4px solid var(--accent); border-radius:8px; padding:11px 15px; color:var(--text-strong); box-shadow:var(--shadow-lg); min-width:220px; animation:slidein .18s ease; }
.toast.error { border-left-color:var(--red); }
.toast.success { border-left-color:var(--green); }
@keyframes slidein { from { transform:translateX(20px); opacity:0; } }

/* ---------- Misc ---------- */
.muted { color:var(--text-faint); }
.row-between { display:flex; align-items:center; justify-content:space-between; }
.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mb8{margin-bottom:8px}
.hidden { display:none !important; }
.divider { height:1px; background:var(--border); margin:10px 0; }
.tag-mini { font-size:11px; background:var(--bg-4); color:var(--text-dim); padding:1px 7px; border-radius:10px; font-weight:700; }

@media (max-width:760px) {
  .modal-body { grid-template-columns:1fr; }
  .modal-side { flex-direction:row; flex-wrap:wrap; }
  .side-btn { width:auto; }
  .sidebar { position:absolute; z-index:40; height:calc(100vh - var(--header-h)); }
  .searchbox { width:46vw; }
}
