:root{
  --bg:#f4f5f7; --surface:#fff; --surface-2:#f8f9fb; --border:#e4e7ec;
  --text:#1a1f2b; --text-2:#3d4656; --muted:#667080; --accent:#4f46e5;
  --accent-soft:#eef0fb; --green:#16a34a; --amber:#d97706; --red:#dc2626;
  --radius:12px; --shadow:0 1px 3px rgba(16,24,40,.06);
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);
  font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}
h1{font-size:22px;margin:0}
h2.sub-h{font-size:15px;margin:26px 0 10px}
a{color:var(--accent);text-decoration:none;cursor:pointer}
a:hover{text-decoration:underline}
.muted{color:var(--muted)}
small.muted{font-weight:400}
.btn{border:0;border-radius:8px;padding:9px 15px;font-weight:600;cursor:pointer;font-size:13.5px}
.btn+.btn{margin-left:8px}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{filter:brightness(1.06)}
.btn-ghost{background:var(--surface-2);color:var(--text);border:1px solid var(--border)}
.btn-ghost:hover{background:#eef0f3}
.btn-danger{background:#fdecec;color:var(--red)}
.btn-sm{padding:5px 10px;font-size:12.5px}
.flash{background:#fef3c7;color:#92400e;padding:10px 16px;text-align:center;font-weight:600}
.empty{text-align:center;color:var(--muted);padding:48px 20px;background:var(--surface);
  border:1px solid var(--border);border-radius:var(--radius)}

/* Auth pages */
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}
.auth-card{background:var(--surface);border:1px solid var(--border);border-radius:16px;
  box-shadow:var(--shadow);padding:32px;width:100%;max-width:400px;display:flex;flex-direction:column}
.auth-card .brand{font-weight:800;color:var(--accent);font-size:18px}
.auth-card h1{font-size:20px;margin:8px 0 14px}
.auth-card label{font-weight:600;font-size:12.5px;margin:10px 0 5px}
.auth-card input{border:1px solid var(--border);border-radius:8px;padding:10px 12px;font-size:14px}
.auth-card input:focus{outline:2px solid var(--accent);border-color:var(--accent)}
.auth-card .btn{margin-top:16px}
.auth-card .muted{margin-top:12px;font-size:13px}

/* Shell */
.shell{display:grid;grid-template-columns:236px 1fr;min-height:100vh}
.sidebar{background:var(--surface);border-right:1px solid var(--border);padding:16px 14px;
  display:flex;flex-direction:column}
.ws-switch{margin-bottom:18px}
.ws-name{font-weight:800;color:var(--accent);font-size:17px}
.ws-switch select{width:100%;border:1px solid var(--border);border-radius:8px;padding:8px 10px;
  font-weight:700;color:var(--accent);background:var(--surface-2)}
nav{display:flex;flex-direction:column;gap:3px}
.nav-item{padding:9px 12px;border-radius:8px;font-weight:600;cursor:pointer}
.nav-item:hover{background:var(--surface-2);text-decoration:none}
.nav-item.active{background:var(--accent);color:#fff}
.nav-soon-group{margin-top:16px;display:flex;flex-direction:column;gap:3px;flex:1}
.soon-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);
  font-weight:700;margin:0 12px 4px}
.nav-soon{padding:6px 12px;color:var(--muted);font-size:12.5px}
.side-foot{border-top:1px solid var(--border);padding-top:12px;margin-top:12px}
.side-foot .who{font-weight:700}
.side-foot .muted{font-size:12px;margin-bottom:4px}

.content{padding:24px 28px;overflow-x:auto}
.topbar{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;
  flex-wrap:wrap;margin-bottom:18px}
.topbar h1{display:flex;align-items:center;gap:9px}
.back{font-size:13px;display:inline-block;margin-bottom:4px}
.dot{width:11px;height:11px;border-radius:50%;display:inline-block}

/* Projects grid */
.proj-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px}
.proj-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:16px;cursor:pointer;box-shadow:var(--shadow)}
.proj-card:hover{border-color:var(--accent)}
.proj-top{display:flex;align-items:center;gap:8px}
.proj-name{font-weight:700}
.proj-desc{color:var(--muted);font-size:13px;margin-top:6px}
.proj-foot{color:var(--muted);font-size:12px;margin-top:12px}

/* Board */
.board{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;align-items:start}
@media(max-width:900px){.board{grid-template-columns:1fr 1fr}}
.col{background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius);padding:10px}
.col-head{font-weight:700;font-size:13px;display:flex;justify-content:space-between;padding:4px 6px 10px}
.col-n{color:var(--muted);font-weight:600}
.col-body{display:flex;flex-direction:column;gap:8px;min-height:20px}
.col-empty{color:var(--muted);text-align:center;font-size:12px;padding:8px}
.task-card{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:10px 11px;cursor:pointer}
.task-card:hover{border-color:var(--accent)}
.tc-title{font-weight:600;font-size:13.5px}
.tc-meta{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}
.tc-move{width:100%;border:1px solid var(--border);border-radius:6px;padding:4px 6px;font-size:12px;background:var(--surface-2)}
.chip{display:inline-flex;align-items:center;gap:4px;background:var(--surface-2);border:1px solid var(--border);
  color:var(--text-2);padding:2px 8px;border-radius:20px;font-size:11px;font-weight:600}
.chip.due{color:var(--amber)}
.pri{padding:2px 8px;border-radius:20px;font-size:11px;font-weight:700}
.pri-low{background:#eef2ff;color:#4f46e5}
.pri-medium{background:#fef3c7;color:#92400e}
.pri-high{background:#fdecec;color:#b91c1c}
.role-owner{background:#ede9fe;color:#6d28d9}
.role-admin{background:#e0f2fe;color:#0369a1}
.role-manager{background:#dcfce7;color:#15803d}
.role-member{background:var(--surface-2);color:var(--muted)}

/* My tasks rows */
.task-rows{display:flex;flex-direction:column;gap:8px;max-width:720px}
.task-row{display:flex;align-items:center;gap:10px;background:var(--surface);border:1px solid var(--border);
  border-radius:10px;padding:11px 13px;cursor:pointer}
.task-row:hover{border-color:var(--accent)}
.tr-title{flex:1;font-weight:600}

/* Members table */
.tbl{width:100%;border-collapse:collapse;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);overflow:hidden}
.tbl th{text-align:left;font-size:12px;color:var(--muted);padding:11px 14px;border-bottom:1px solid var(--border)}
.tbl td{padding:11px 14px;border-bottom:1px solid var(--border);font-size:13.5px}
.tbl tr:last-child td{border-bottom:0}
.tbl select{border:1px solid var(--border);border-radius:6px;padding:5px 8px}

/* Modal */
.overlay{position:fixed;inset:0;background:rgba(16,24,40,.45);display:flex;align-items:center;
  justify-content:center;padding:20px;z-index:100}
.overlay[hidden]{display:none}
.modal{background:var(--surface);border-radius:14px;width:100%;max-width:460px;box-shadow:0 20px 50px rgba(0,0,0,.25)}
.modal-head{display:flex;align-items:center;padding:16px 20px;border-bottom:1px solid var(--border)}
.modal-head h3{margin:0;font-size:16px;flex:1}
.modal-head .x{border:0;background:none;font-size:22px;cursor:pointer;color:var(--muted);line-height:1}
.modal-body{padding:18px 20px;display:flex;flex-direction:column;gap:13px;max-height:66vh;overflow-y:auto}
.modal-foot{padding:14px 20px;border-top:1px solid var(--border);display:flex;gap:8px;justify-content:flex-end;align-items:center}
.field{display:flex;flex-direction:column;gap:5px}
.field label{font-weight:600;font-size:12.5px}
.field input,.field textarea,.field select{border:1px solid var(--border);border-radius:8px;padding:9px 11px;font-size:14px;font-family:inherit}
.field input:focus,.field textarea:focus,.field select:focus{outline:2px solid var(--accent);border-color:var(--accent)}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}

/* Toast */
.toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);background:#111827;color:#fff;
  padding:10px 18px;border-radius:10px;font-size:13.5px;z-index:200;box-shadow:0 6px 20px rgba(0,0,0,.25)}

@media(max-width:720px){.shell{grid-template-columns:1fr}
  .sidebar{flex-direction:row;flex-wrap:wrap;align-items:center;gap:10px}
  .nav-soon-group{display:none}.side-foot{border:0;margin:0;padding:0}}
